0

Is it possible to assign the sticky bit to sudo in order to execute any command as a normal user?

Let's suppose that we have the user test and then:

test@test$ apt-get update

But I don't want to use sudo nor modify the sudoers file, is this possible using only the sticky bit?

3

Short answer: You can't execute arbitrary admin commands without either a sudo or being root.

Long answer: You must either have NOPASSWD in /etc/sudoers, or log as root. See https://askubuntu.com/questions/147241/execute-sudo-without-password.

visudo

then add a line

username ALL=(ALL) NOPASSWD: ALL
  • For security, you can also set the NOPASSWD argument for specific commands as user ALL=NOPASSWD: /sbin/poweroff, /sbin/reboot – Peschke Apr 15 '16 at 0:39
  • @Peschke but you still need to use sudo poweroff, sudo reboot. The OP wanted to get rid of the sudo part. – telcoM Sep 23 at 21:58
  • @telcoM yep, the answer above covered that. My comment was just expanding the answer. – Peschke Sep 23 at 22:10
  • @Peschke I see, my mistake, sorry about the noise then. – telcoM Sep 24 at 7:05
1

Are you finding it a burden typing "sudo" each time when you have multiple commands that you must run using root privileges? An alternative to making it so that you don't have to use sudo with every command is to use sudo one time, to become root:

sudo su -

You will get a root shell, which you can use for all of the commands that need root privilege. When you are done needing root privileges, you can use control-d to exit the root shell and return to your normal user privileges.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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