You are not logged in.
Normally, I don't use "sudo". But today I went to "Mediamarkt" and saw an "Acer Aspire one"!
Opened terminal, typed "sudo su", "cd /" and "rm -fr *"
Kind of fun. I will be there tomorrow again and take a look.
... nice idea. One employee at 'Mediamarkt' will be veeery happy to set up a new system.
I use 'sudo' when I just have to execute one command as root.... otherwise I use 'su -' as well..
Offline
I love sudo. It truly makes it easier to perform root tasks. Yes, it takes getting use to typing 'sudo' in front of administrative commands, but that's what aliases are for. If there are certain commands you use on a frequent basis, then simply create an alias for it. For example, I use aliases for reboot, poweroff, and pacman. As far as typing a password all the time, you can have sudo set to not have to include the password after you issue the command. I rarely login as root nowadays.
Best Regards,
The Vytalone
Offline
I Love Sudo :d
"god@heaven$ emerge world"
~ Genesis on Gentoo
Offline
b9anders wrote:What is the difference?
The default behavior of
su
is to maintain the current directory and the environmental variables of the original user (rather than switch to those of the new user).
It sometimes can be advantageous for a system administrator to use the shell account of an ordinary user rather than its own. In particular, occasionally the most efficient way to solve a user's problem is to log into that user's account in order to reproduce or debug the problem.However, in many situations it is not desirable, or it can even be dangerous, for the root user to be operating from an ordinary user's shell account and with that account's environmental variables rather than from its own. While inadvertently using an ordinary user's shell account, root could install a program or make other changes to the system that would not have the same result as if they were made while using the root account. For instance, a program could be installed that could give the ordinary user power to accidentally damage the system or gain unauthorized access to certain data.
Thus, it is advisable that administrative users, as well as any other users that are authorized to use su (of which there should be very few, if any), acquire the habit of always following the su command with a space and then a hyphen. The hyphen has two effects: (1) it switches the current directory to the home directory of the new user (e.g., to /root in the case of the root user) and (2) it changes the environmental variables to those of the new user. That is, if the first argument to su is a hyphen, the current directory and environment will be changed to what would be expected if the new user had actually logged on to a new session (rather than just taking over an existing session).
Thus, administrators should generally use su as follows:
su -
An identical result is produced by adding the username root, i.e.,
su - root
Likewise, the same can be done for any other user, e.g., for a user named bob:
su - bob
You may want to make an alias in your .bashrc to assign su to su -, especially if you're too lazy to type su - every time.
Kinda makes sense. But why won't my .bashrc for example be read?
Offline
Kinda makes sense. But why won't my .bashrc for example be read?
That's a good question. I just experimented with this myself. The command 'su -' does not source .bashrc files. You will need to create a .profile file under /root directory and just copy your contents of your .bashrc to that file and this should work.
Best Regards,
The Vytalone
Offline
I use sudo when I forget that something needs to be done as root and bash yells at me for being a dumbass. It's so much easier to just press "up" "home" "sudo " and enter, rather than "su -" and retyping what I was doing.
I'm also a Ubuntu user, so it's a bit of a habit.
Makes it eassy to set aliases. Typing "spacsyu" is much quicker and less prone to typo's for me that "sudo pacman -Syu".
Last edited by SkonesMickLoud (2008-10-02 08:33:05)
Offline
I use sudo when I forget that something needs to be done as root and bash yells at me for being a dumbass. It's so much easier to just press "up" "home" "sudo " and enter, rather than "su -" and retyping what I was doing.
Just to let you know, sudo !! runs your previous command again, this time prefixed with sudo. Saves a few keystrokes.
moljac024: No one really knows what happens inside /dev/null... it could be a gateway to another universe....
dunc: If it is, the people who live there must be getting pretty annoyed by now with all the junk we send them.
Offline