Duncan Lithgow wrote:
The important tip that I didn't get for ages was using typing # su -
- '#' means 'you're logged in as a user'
- '$' means 'you're logged in as root'
- If you've logged in as a user and need to make something work as
root. You can right click and get a terminal, then you can change to any user by typing sy <user-name> you'll then be prompted for password.
That's "su <user-name>" (or "su - <user-name>"), not "sy <user-name>"; watch out for typos when giving advice to newbies who might not spot them...
- If you type
# su - it will ask you for your root password and behave as if you'd loged in as root. I don't understand why but it works better than # su root
It works better because (as is hinted at in "man su"), using the "-" parameter makes su run as a login shell, which will correctly set up root's environment (which includes /sbin and /usr/sbin, two directories full of useful admin tools, in the PATH variable). Not using the "-" parameter means that su does not run as a login shell and hence doesn't set up root's environment, so amongst other things, the /sbin and /usr/sbin directories don't get put in the PATH variable.
Paul.