I’m very new to the MacScripter forum and almost just as new to Applescript. I’m trying to create a script to help my IT switch over to remote login and part of the process is moving old users files from a user named username to a new user specified with their specific username. However, I’m having trouble accomplishing the correct permissions. I want the script to login as root using sudo -s and an admin password(which works fine in Terminal) but right now the script is running everything in the admin password without doing the sudo login and I come back with no permissions to do the copy from one user to another. This is what I have so far and I hope someone can point me in the direction of what I’m doing wrong.
tell application “Terminal”
do shell script “sudo -s” password “nimda” with administrator privileges
script “mkdir /Users/orr;
cp -R /Users/username/* /Users/orr;
chown -R orr /Users/orr;
I’m operating on OS 10.3 because that is the main OS on which we’re making these adjustments. Any suggesetions or comments?
Model: Quicksilver Tower G4 800 MHz
Browser: Safari 312
Operating System: Mac OS X (10.3.9)
You shouldn’t have to use Terminal (or sudo) to do this:
do shell script "mkdir /Users/orr; cp -R /Users/username/* /Users/orr; chown -R orr /Users/orr" with administrator privileges
That got rid of a lot of my error messages for permissions but I still had permissions denied on the Movies folder for some reason and the actual cp command didn’t do anything. I seem to have no problem with creating the folder but all the commands after that don’t take much effect.
I’m having a similar problem, I think.
I have this line in my script to toggle TivoDesktop on and off from my script menu:
do shell script “SystemStarter start TiVoDesktop” with administrator privileges
After checking if the TiVoDesktop process is already on with:
set tivoProcess to do shell script “ps -ax | grep TiVo”
if tivoProcess contains “TivoDesktop” then
set tivoIsOff to false
set tivoIsOff to true
From watching the Activity Monitor I can see that one System Events process is created by:
do shell script “ps -ax | grep TiVo”
and a second along with starting the TiVoDesktop process, and after this second do shell script line no other lines are executed. I don’t quite understand why.
The other part of the script:
do shell script “SystemStarter stop TiVoDesktop” with administrator privileges
will work fine once the first of the two System Events process that was created is killed, but if I kill it using the process ID (which works ok) before the line that starts TiVoDesktop, it won’t finish the script and it won’t run any other scripts.
I’m not running it from the script editor, but from the script menu (I don’t know if that makes a difference). If I do run it from the script editor, the script editor process will no longer respond and has to be force quit.
Starting and stopping the TiVoDesktop works fine from the terminal though, I think because a System Events process isn’t created.
Any help you can give would be very appreciated.