1

Let's say I have two user accounts:

  • user (without any sudo permissions)
  • user_with_sudo (with all sudo permissions)

Now, I'm logged in as user but want to do something as root, e.g. switch to a full root Bash. sudo -s won't work because I'm not a sudoer.

So, I first have to switch to a sudoer user:

su user_with_sudo

And enter the password.

Now I'm logged in as user_with_sudo and I'm able to call sudo -s but I have to enter the same password again, which is a little bit annoying.

Is there a command, which switches to a sudoer-user and runs a command as root with only typing the password once? Basically, is there an one-command replacement for:

su user_with_sudo
(enter password)
sudo -s
(enter same password again)
1
  • What's the point of this configuration? If you're giving all these people the password for user_with_sudo, why not just give them the root password?
    – Barmar
    Oct 7, 2014 at 18:27

1 Answer 1

0

From the man page of the sudo command you can edit the /etc/sudoers file to allow this

https://unix.stackexchange.com/questions/43135/allowing-a-user-to-use-sudo-without-a-password

2
  • This would add sudo rights to "user", which I wanted to prevent. The user account "user" is meant as a shared account for many people, they shouldn't be allowed to alter the system. Another option would be to request an other password when calling sudo, but I'm just wondering if it's possible to call "sudo as user_with_sudo" with one command instead of su & sudo.
    – Bernhard
    Oct 7, 2014 at 15:39
  • @Bernhard I think he's suggesting that you turn off the password requirement for user_with_sudo. So everyone else has to enter the password to become that user, but they don't have to enter the password again to become root.
    – Barmar
    Oct 7, 2014 at 18:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .