The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
su - how to become a super user. avoid using root 18 October 1998
Need more help on this topic? Click here
This article has 2 comments
Show me similar articles
If you're like most people new to Unix, you do everything as root.  You shouldn't.   I know I don't follow my own advice, but I'm trying to improve.

Create yourself another account.  Use that instead of root.  Unless you really need root.  You can always invoke su to become a super user.   That way, you don't have to log out and back in every time you need the power.

wheel
Only users in the wheel group can run su.  The group can be specified when creating a user via adduser.  To add a user manuall, just put the name of the user at the end of the line in /etc/group.  For example:
wheel:*:0:root,marc

This adds the user marc to the wheel group.

su
To become super user, you do this:
bash-2.02$ su
Password:
su-2.02#

At the password prompt, supply the root password.

Note that you might also want to use either the -l or the -m options.  Respectively, these options will simulate a full login or leave the environment unmodified.  see man su for details.


Need more help on this topic? Click here
This article has 2 comments
Show me similar articles