applescript permission error

Hi,

I’m writing an applescript so that when students log into the machines, it will remove the local user profile folders like:

  • Movies
  • Desktop
  • Music
  • Pictures
  • Downloads

And create a symlink that points these folders to a NAS but when the script gets to:

do shell script (“rm -rf /Users/$USER/Music”) users get a ‘Permission denied’ error message.

I tried using do shell script (“rm -rf /Users/$USER/Music”) with administrator privileges as well as

do shell script (“sudo rm -rf /Users/$USER/Music”) but it then prompts the user to enter their password.

Is there a way to avoid the password input without adding username ‘name’ password ‘yourpassword’ with administrator privileges. I don’t like the idea of putting username and passwords into a file that can be viewed to see these credentials

Thanks

Hi dcirona,

I don’t have a solution, but maybe you can set a daily password that only the users know about. That would be an admin’s password. Other than that, if they don’t have admin privileges I don’t think they can pass.

Not sure, but nobody has a solution yet.

gl,
kel

You could use that also as a lesson on how to keep your password to yourself! For the kids, that would be a good lesson.