This question is answered a number of times in the net, but none of those answer resulted useful in my case.
The problem
Accessing a remote machine using private key, I usually require root permissions, which imply writing a long password and is annoying.
For the purpose of having sudo su
, I tried following steps:
- Ensure the line
<user> ALL=(ALL) NOPASSWD: ALL
is in /etc/sudoers - Ensure the user is in
sudo
user group:$groups <user>
-> sudo
But trying sudo su
will just prompt me for my own password: [sudo] password for <user>:
The question
How to have password-less sudo su
?
sudo service
(something likesudo service sudo restart
) after you updated the the config file? – Yaron Feb 26 '18 at 10:27sudo su
please use eithersudo -i
orsudo su -
if you usesudo su
your user variable such as PATH or aliases are more likely to be corrupted will be usable as root. If someone can corrupt your profil it might inject some env variable able to give him root access afterward.sudo -i
andsudo su -
will unload you profil and load only root env variable – Kiwy Feb 26 '18 at 10:32sudo su
: https://unix.stackexchange.com/questions/218169/is-there-ever-a-good-reason-to-run-sudo-su – Kusalananda Feb 26 '18 at 10:53