I have a daemon running at which users, using a tool, can add information.
The daemon convert this information to information files in a predefined folder structure, choosen by the user.
Each user can choose from a number of predefined folder structures.
Till now the manager of the user group, ask an administrator to set this up.
The ‘Repository’ folder is owned by a special User ‘RepoTechLab’ and Group ‘RepoTechLab’.
User RepoTechLab read and write
Group RepoTechLab read only
Everybody noaccess
No one should and can look at the data directly.
Everything happens by using the Tool and daemon.
This works perfect.
For the future I want that the user can choose and setup the structure by them self.
I did try several things but my main problem is this.
How can I use applescript or bash script, so that a normal user starts that script, which can go into the Repository folder and create the folder structure.
To test this action I did try
do shell script "mkdir /Volumes/Repository/test" user name "RepoTechLab" password "********"
but didn’t work. I get mkdir: /Volumes/Repository/test: Permission denied
Thanks you, for your reply.
However, maybe I was unclear with this line
“However, the RepoTechDev user and group have no admin rights, so adding ‘with administrator privileges’ will not work.”
This should read as “so adding ‘with administrator privileges’ will not work, because of the admin password is then in the open”.
I dont mind to let the password of user RepoTechDev inside the script, because I will cut it in pieces or, if possible, try to use a sudoers list with something like
RepoTechDev ALL=NOPASSWD:/Volumes/…/…/MyScript, if that works on automator files or and applescript files!
This problem is solved after reading about the keychain scripting dict.
In case if someone interested, this is what I come up with as POC and is quick and dirty and any comment is welcome on that. If you want to try this, create a RepoKey in your KeyChain ( funny, I have to let the script launch keychain otherwise it takes along time, but thats for later ).
set accesskey to "RepoPW"
set repoPW to GetPasswordFromKeychain(accesskey)
if repoPW is not null then
try
-- still no access
do shell script "mkdir -p " & " /Volumes/Repository/NEW_TEST" user name "_svn" password repoPW
on error
display dialog "Creation of your choosen Structure failed ( Service Desk is notified ).
Contact your Repository Manager, or call the Service Desk. " buttons {"OK"} default button "OK" with icon 0 with title "Abort - Error notification"
-- return null
end try
else
-- return null
quit
end if
-- GET PASSWORD USING KEYCHAIN ACCESS
on GetPasswordFromKeychain(pwKey)
tell application "Keychain Scripting"
launch
try
tell keychain "System.keychain"
return password of some key whose name is pwKey
end tell
on error
display dialog "No correct keychain item found to continue ( Service Desk is notified ).
Contact your Repository Manager, or call the Service Desk. " buttons {"OK"} default button "OK" with icon 0 with title "Abort - Error notification"
return null
end try
end tell
end GetPasswordFromKeychain
[b]
But, my original question is still standing.[/b]
Any help is appreciated
thanks
rva
edit - did put launch inside the code otherwise it cant find the key.