What types of users can I use with "sudo"?

0

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!

pnongrata

Posted 2013-04-17T16:43:59.077

Reputation: 2 212

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 – 2013-04-18T13:59:07.713

Answers

1

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.

Scott Adams

Posted 2013-04-17T16:43:59.077

Reputation: 126

0

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.

lopsided98

Posted 2013-04-17T16:43:59.077

Reputation: 381

0

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

nerdwaller

Posted 2013-04-17T16:43:59.077

Reputation: 13 366

1Or run arbitrary shell commands from within vim. Same for "less" if vi/vim are installed and accessible for less via the v key. – tink – 2013-04-17T18:55:11.413