13.3. Running Superuser CommandsIn the world of Mac OS X, there are three kinds of people: standard account holders, administrators, and superusers. The kind of account you have determines what kind of changes you can make to your Mac (Table 13-1).
Say you wanted to edit some files in the System Library CoreServices folder, where Mac OS X stores all its private settings and programs. Naturally, if you were a standard or administrator account holder, the files there would be off-limits. However, by posing as a superuser, you can convince Mac OS X to let you modify those system files. Since the chown Unix program transfers control of a folder from Mac OS X to you, your first instinct would probably be to write an AppleScript like this: do shell script "chown user /System/Library/CoreServices/"
In essence, that single-line script tells Mac OS X, "Run the chown program, and tell it to transfer ownership of the System Library CoreServices folder to me." Unfortunately, you'll encounter a roadblock when you run the script, as described in Figure 13-4. The solution? Add with administrator privileges to the end of your command: do shell script "chown user /System/Library/CoreServices/" ¬ with administrator privileges Now, rather than seeing an error message when you run your script, you see a password dialog box, as shown in Figure 13-5. Once you enter your password, your script successfully runs chown, making you the new owner of the CoreServices folder. Be careful what you do with your newfound powers, though; if you feel like deleting a system program (say, the Finder), nothing will stop you now.
|