Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'A fix for an iTunes 6.0.1 command line install bug' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A fix for an iTunes 6.0.1 command line install bug
Authored by: adams4 on Dec 16, '05 09:00:05AM

The reason that sudo works and su doesn't is that su isn't supposed to work that way.

su is the command to substitute user, which can be useful when you're running Terminal and need to "look like" another user when you execute commands in that shell. What's happening is that you've started a new shell within your current shell, and the shell will just twiddle its virtual thumbs waiting for input. Once you su, you need to exit that shell to get back to your own user (and shell).

sudo, on the other hand, means "execute a command as another user." If you're already authenticated in the current shell (e.g., you authenticated less than 5 minutes ago), then the command is run as if you were the user you've substituted; no new shell is generated or needed. When the command is done, you're still you. :)

Adam Spector.

[ Reply to This | # ]

A fix for an iTunes 6.0.1 command line install bug
Authored by: plambert on Dec 16, '05 11:52:08AM

Not exactly true.

The "su" command simply runs a shell or command as another user, if you have the target user's password. The "sudo" command does the same, but first consults a configuration file which by default only requires the originating user's password (and, on Mac OS X, only allows sudo access for users in the "admin" group).

The GUI will run the installation as root, and so the "su" becomes the user in question, runs that command, and then continues on in the script.

If you are running "softwareupdate" not as root, the "su" will fail, because it's asking for root's password, not yours, and root doesn't have a valid password by default on Mac OS X.

Plus, it'll just turn around and run the following command as you again.

[ Reply to This | # ]

A fix for an iTunes 6.0.1 command line install bug
Authored by: Johnny_B on Dec 16, '05 06:13:39PM

The script is run as root. cron is runned as root. I actually use an easy perl socket server which runs as root and when it gets daily/weekly/monthly it will run these script. In the weekly script, I've included softwareupdate. The perl server is started with a StartupItem which is runned as root.

[ Reply to This | # ]