Your Mac OS X user account runs with restricted privileges; there are parts of the filesystem to which you don't have access, and there are certain activities that are prohibited until you supply a password. For example, when you run the Software Update utility from System Preferences, Mac OS X may ask you for your password before it proceeds. This extra authentication step allows Software Update to run installers with superuser privileges. You can invoke these same privileges at the command line by prefixing a command with sudo , a utility that prompts you for your password and executes the command as the superuser. You must be an Admin user to use sudo . The user you created when you first set up your Mac will be an Admin user. You can add new Admin users or grant Admin status to a user in System Preferences Accounts.
You may need to use sudo when you install Unix utilities or if you want to modify a file you don't own. Suppose that you accidentally created a file in the /Users directory while you were doing something else as the superuser. You won't be able to modify it with your normal privileges, so you'll need to use sudo : $ ls -l logfile.out -rw-r--r-- 1 root wheel 1784064 Nov 6 11:25 logfile.out $ rm logfile.out override rw-r--r-- root/wheel for logfile.out? y rm: logfile.out: Permission denied $ sudo rm logfile.out Password: $ ls -l logfile.out ls: logfile.out: No such file or directory If you use sudo again within five minutes, it won't ask for your password. Be careful using sudo , since it gives you the ability to modify protected files, all of which are protected to ensure the system runs properly. |