Run the bash shell in su mode

May 12, '04 09:42:00AM

Contributed by: Anonymous

Ever tried to su to root in terminal? here's what happens under OSX 10.3:

$ su
Password:
su: Sorry
... and here's a quick fix ... add the following to your ~/.bash_profile file (in your home directory) using your favourite text editor:
alias su="sudo bash"
Restart terminal, and away you go!
$ su
Password: [type your password, you must be an administrator]
02:03:06 | compy386:~ root#
Be careful what you do, the slightest typo could zero your hard drive!

[robg adds: I don't run bash, but in my testing from the bash shell, su worked fine the first time I tried it. However, this hint is useful if you want to run the bash shell as root, instead of the default sh.]

Comments (12)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20040509200602480