You are not logged in.

#76 2008-09-12 20:05:10

chris89
Member
From: Austria
Registered: 2008-03-18
Posts: 48

Re: Who uses sudo?

karoshi wrote:

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 *" tongue
Kind of fun. I will be there tomorrow again and take a look.

big_smile ... 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

#77 2008-09-14 03:06:34

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

Re: Who uses sudo?

I pretty much only use sudo, with root as a backup. For programs that are often used and that often require admin privileges, I just add an alias or something.

Offline

#78 2008-09-30 16:57:46

vytalelementz
Member
From: West Palm Beach, FL, USA
Registered: 2007-04-23
Posts: 99

Re: Who uses sudo?

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

#79 2008-09-30 17:24:30

obsrv
Member
Registered: 2005-02-08
Posts: 137

Re: Who uses sudo?

I Love Sudo :d


"god@heaven$ emerge world"

              ~ Genesis on Gentoo

Offline

#80 2008-09-30 18:22:34

rine
Member
From: Germany
Registered: 2008-03-04
Posts: 217

Re: Who uses sudo?

Misfit138 wrote:
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

#81 2008-10-01 12:40:56

vytalelementz
Member
From: West Palm Beach, FL, USA
Registered: 2007-04-23
Posts: 99

Re: Who uses sudo?

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

#82 2008-10-02 08:31:28

SkonesMickLoud
Arch Linux f@h Team Member
From: The D of C
Registered: 2008-09-20
Posts: 178

Re: Who uses sudo?

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

#83 2008-10-02 23:12:15

wirenik
Member
Registered: 2008-08-22
Posts: 134

Re: Who uses sudo?

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. wink


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

Board footer

Powered by FluxBB