Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I thought you could only use sudo to temporarily become root:

sudo vim /etc/resolv.conf

But recently I saw a shell snippet depicting a user using sudo to become a specific user:

sudo -H -u devops -s

Where devops was not the original username. After becoming devops, the user now had elevated privileges.

So are there ways of creating more than 1 root user? What is devops's relation to root in the example above? How do these elevated-but-not-quite-root users get created/managed?

Also, same question, but for su.

Thanks in advance!

share|improve this question
    
There is only one root user. Root is called root because it is the root of all users with the userid 0. There can't be two users with the same userid. –  FSMaxB Apr 18 '13 at 13:59

3 Answers 3

up vote 1 down vote accepted

Taken from the man page:

sudo is used to execute commands as another. Root or any other user that you have creds for. So, devops is just another user on the system.

DESCRIPTION

sudo allows a permitted user to execute a command as the superuser or another user, as specified by the security policy.

UPDATE;

Same for su. Any user, root or other user on system. Here is the man page:

su - run a shell with substitute user and group IDs

SYNOPSIS

su [OPTION]... [-] [USER [ARG]...]

DESCRIPTION

Change the effective user id and group id to that of USER.

share|improve this answer

sudo can be used to run a command as any user (with the -u option). In your example devops was another user on the system. "devops" probably had more privileges to read and write to certain directories. The same goes for su where you can specify a user as a parameter. Both su and sudo switch to the root user by default.

share|improve this answer

Any user can have sudo rights on a unix system. devops is simply one of those users on that system, but by default the only user account should be root and the others are added (though distros like Ubuntu have the user who is setup during install in that list too).

If you need various users (or groups) sudo privs, look into # visudo. You can specify what users can access what with root rights. (be careful with that, if you give 'guest' access to vim with root privs, they could adjust system files, for example).

share|improve this answer
1  
Or run arbitrary shell commands from within vim. Same for "less" if vi/vim are installed and accessible for less via the v key. –  tink Apr 17 '13 at 18:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.