Allowing `sudo su` without password over Ubuntu [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite













This question already has an answer here:



  • Allowing a user to use sudo without a password

    2 answers



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?







share|improve this question














marked as duplicate by Kiwy, Jesse_b, Jeff Schaller, G-Man, Satō Katsura Feb 27 at 7:55


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • did you restart the Ubuntu machine or at least the sudo service (something like sudo service sudo restart) after you updated the the config file?
    – Yaron
    Feb 26 at 10:27






  • 2




    It is a bad idea to have no password for sudo?
    – George Udosen
    Feb 26 at 10:28










  • never use ` sudo su` please use either sudo -i or sudo su - if you use sudo 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 and sudo su - will unload you profil and load only root env variable
    – Kiwy
    Feb 26 at 10:32











  • Its a common way for automated processes, so why not? Yeah, you could make it only for special commands, but for development its okay. As long as there is no security audit ;)
    – Marc
    Feb 26 at 10:33










  • Related, about sudo su: unix.stackexchange.com/questions/218169/…
    – Kusalananda
    Feb 26 at 10:53














up vote
0
down vote

favorite













This question already has an answer here:



  • Allowing a user to use sudo without a password

    2 answers



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?







share|improve this question














marked as duplicate by Kiwy, Jesse_b, Jeff Schaller, G-Man, Satō Katsura Feb 27 at 7:55


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • did you restart the Ubuntu machine or at least the sudo service (something like sudo service sudo restart) after you updated the the config file?
    – Yaron
    Feb 26 at 10:27






  • 2




    It is a bad idea to have no password for sudo?
    – George Udosen
    Feb 26 at 10:28










  • never use ` sudo su` please use either sudo -i or sudo su - if you use sudo 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 and sudo su - will unload you profil and load only root env variable
    – Kiwy
    Feb 26 at 10:32











  • Its a common way for automated processes, so why not? Yeah, you could make it only for special commands, but for development its okay. As long as there is no security audit ;)
    – Marc
    Feb 26 at 10:33










  • Related, about sudo su: unix.stackexchange.com/questions/218169/…
    – Kusalananda
    Feb 26 at 10:53












up vote
0
down vote

favorite









up vote
0
down vote

favorite












This question already has an answer here:



  • Allowing a user to use sudo without a password

    2 answers



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?







share|improve this question















This question already has an answer here:



  • Allowing a user to use sudo without a password

    2 answers



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?





This question already has an answer here:



  • Allowing a user to use sudo without a password

    2 answers









share|improve this question













share|improve this question




share|improve this question








edited Feb 26 at 11:25

























asked Feb 26 at 10:21









Adrian Maire

294417




294417




marked as duplicate by Kiwy, Jesse_b, Jeff Schaller, G-Man, Satō Katsura Feb 27 at 7:55


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by Kiwy, Jesse_b, Jeff Schaller, G-Man, Satō Katsura Feb 27 at 7:55


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • did you restart the Ubuntu machine or at least the sudo service (something like sudo service sudo restart) after you updated the the config file?
    – Yaron
    Feb 26 at 10:27






  • 2




    It is a bad idea to have no password for sudo?
    – George Udosen
    Feb 26 at 10:28










  • never use ` sudo su` please use either sudo -i or sudo su - if you use sudo 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 and sudo su - will unload you profil and load only root env variable
    – Kiwy
    Feb 26 at 10:32











  • Its a common way for automated processes, so why not? Yeah, you could make it only for special commands, but for development its okay. As long as there is no security audit ;)
    – Marc
    Feb 26 at 10:33










  • Related, about sudo su: unix.stackexchange.com/questions/218169/…
    – Kusalananda
    Feb 26 at 10:53
















  • did you restart the Ubuntu machine or at least the sudo service (something like sudo service sudo restart) after you updated the the config file?
    – Yaron
    Feb 26 at 10:27






  • 2




    It is a bad idea to have no password for sudo?
    – George Udosen
    Feb 26 at 10:28










  • never use ` sudo su` please use either sudo -i or sudo su - if you use sudo 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 and sudo su - will unload you profil and load only root env variable
    – Kiwy
    Feb 26 at 10:32











  • Its a common way for automated processes, so why not? Yeah, you could make it only for special commands, but for development its okay. As long as there is no security audit ;)
    – Marc
    Feb 26 at 10:33










  • Related, about sudo su: unix.stackexchange.com/questions/218169/…
    – Kusalananda
    Feb 26 at 10:53















did you restart the Ubuntu machine or at least the sudo service (something like sudo service sudo restart) after you updated the the config file?
– Yaron
Feb 26 at 10:27




did you restart the Ubuntu machine or at least the sudo service (something like sudo service sudo restart) after you updated the the config file?
– Yaron
Feb 26 at 10:27




2




2




It is a bad idea to have no password for sudo?
– George Udosen
Feb 26 at 10:28




It is a bad idea to have no password for sudo?
– George Udosen
Feb 26 at 10:28












never use ` sudo su` please use either sudo -i or sudo su - if you use sudo 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 and sudo su - will unload you profil and load only root env variable
– Kiwy
Feb 26 at 10:32





never use ` sudo su` please use either sudo -i or sudo su - if you use sudo 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 and sudo su - will unload you profil and load only root env variable
– Kiwy
Feb 26 at 10:32













Its a common way for automated processes, so why not? Yeah, you could make it only for special commands, but for development its okay. As long as there is no security audit ;)
– Marc
Feb 26 at 10:33




Its a common way for automated processes, so why not? Yeah, you could make it only for special commands, but for development its okay. As long as there is no security audit ;)
– Marc
Feb 26 at 10:33












Related, about sudo su: unix.stackexchange.com/questions/218169/…
– Kusalananda
Feb 26 at 10:53




Related, about sudo su: unix.stackexchange.com/questions/218169/…
– Kusalananda
Feb 26 at 10:53










2 Answers
2






active

oldest

votes

















up vote
1
down vote













I often place it below the line



# User privilege specification
root ALL=(ALL:ALL) ALL
+++ myuser ALL=(ALL) NOPASSWD: ALL


The better way is to use an own file in /etc/sudoers.d with the line above.



If you would like to use the group policy, you need to modify the line for your group



# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) NOPASSWD: ALL


Otherwise the group policy will overwrite your user policy and you will be asked for the password.



And an other hint:

Please don't use "sudo su". Instead use sudo su - or sudo -i. This will unload your env and load the one of root, avoiding to use bad env variable from your account with root.






share|improve this answer





























    up vote
    1
    down vote













    Your sudoers file has something that already grants you the ability to run sudo su (or possibly any commands), but does not include the NOPASSWD: option.



    Ordering within the sudoers file is important: last match wins.



    You can use sudo -l to list all the sudo Defaults options and all the allowed commands for your user account.






    share|improve this answer




















    • sudo -l return : (ALL : ALL) ALL
      – Adrian Maire
      Feb 26 at 11:20

















    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    I often place it below the line



    # User privilege specification
    root ALL=(ALL:ALL) ALL
    +++ myuser ALL=(ALL) NOPASSWD: ALL


    The better way is to use an own file in /etc/sudoers.d with the line above.



    If you would like to use the group policy, you need to modify the line for your group



    # Allow members of group sudo to execute any command
    %sudo ALL=(ALL:ALL) NOPASSWD: ALL


    Otherwise the group policy will overwrite your user policy and you will be asked for the password.



    And an other hint:

    Please don't use "sudo su". Instead use sudo su - or sudo -i. This will unload your env and load the one of root, avoiding to use bad env variable from your account with root.






    share|improve this answer


























      up vote
      1
      down vote













      I often place it below the line



      # User privilege specification
      root ALL=(ALL:ALL) ALL
      +++ myuser ALL=(ALL) NOPASSWD: ALL


      The better way is to use an own file in /etc/sudoers.d with the line above.



      If you would like to use the group policy, you need to modify the line for your group



      # Allow members of group sudo to execute any command
      %sudo ALL=(ALL:ALL) NOPASSWD: ALL


      Otherwise the group policy will overwrite your user policy and you will be asked for the password.



      And an other hint:

      Please don't use "sudo su". Instead use sudo su - or sudo -i. This will unload your env and load the one of root, avoiding to use bad env variable from your account with root.






      share|improve this answer
























        up vote
        1
        down vote










        up vote
        1
        down vote









        I often place it below the line



        # User privilege specification
        root ALL=(ALL:ALL) ALL
        +++ myuser ALL=(ALL) NOPASSWD: ALL


        The better way is to use an own file in /etc/sudoers.d with the line above.



        If you would like to use the group policy, you need to modify the line for your group



        # Allow members of group sudo to execute any command
        %sudo ALL=(ALL:ALL) NOPASSWD: ALL


        Otherwise the group policy will overwrite your user policy and you will be asked for the password.



        And an other hint:

        Please don't use "sudo su". Instead use sudo su - or sudo -i. This will unload your env and load the one of root, avoiding to use bad env variable from your account with root.






        share|improve this answer














        I often place it below the line



        # User privilege specification
        root ALL=(ALL:ALL) ALL
        +++ myuser ALL=(ALL) NOPASSWD: ALL


        The better way is to use an own file in /etc/sudoers.d with the line above.



        If you would like to use the group policy, you need to modify the line for your group



        # Allow members of group sudo to execute any command
        %sudo ALL=(ALL:ALL) NOPASSWD: ALL


        Otherwise the group policy will overwrite your user policy and you will be asked for the password.



        And an other hint:

        Please don't use "sudo su". Instead use sudo su - or sudo -i. This will unload your env and load the one of root, avoiding to use bad env variable from your account with root.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Feb 26 at 10:35









        Kiwy

        5,36743350




        5,36743350










        answered Feb 26 at 10:29









        Marc

        3343




        3343






















            up vote
            1
            down vote













            Your sudoers file has something that already grants you the ability to run sudo su (or possibly any commands), but does not include the NOPASSWD: option.



            Ordering within the sudoers file is important: last match wins.



            You can use sudo -l to list all the sudo Defaults options and all the allowed commands for your user account.






            share|improve this answer




















            • sudo -l return : (ALL : ALL) ALL
              – Adrian Maire
              Feb 26 at 11:20














            up vote
            1
            down vote













            Your sudoers file has something that already grants you the ability to run sudo su (or possibly any commands), but does not include the NOPASSWD: option.



            Ordering within the sudoers file is important: last match wins.



            You can use sudo -l to list all the sudo Defaults options and all the allowed commands for your user account.






            share|improve this answer




















            • sudo -l return : (ALL : ALL) ALL
              – Adrian Maire
              Feb 26 at 11:20












            up vote
            1
            down vote










            up vote
            1
            down vote









            Your sudoers file has something that already grants you the ability to run sudo su (or possibly any commands), but does not include the NOPASSWD: option.



            Ordering within the sudoers file is important: last match wins.



            You can use sudo -l to list all the sudo Defaults options and all the allowed commands for your user account.






            share|improve this answer












            Your sudoers file has something that already grants you the ability to run sudo su (or possibly any commands), but does not include the NOPASSWD: option.



            Ordering within the sudoers file is important: last match wins.



            You can use sudo -l to list all the sudo Defaults options and all the allowed commands for your user account.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Feb 26 at 10:47









            telcoM

            10.7k11132




            10.7k11132











            • sudo -l return : (ALL : ALL) ALL
              – Adrian Maire
              Feb 26 at 11:20
















            • sudo -l return : (ALL : ALL) ALL
              – Adrian Maire
              Feb 26 at 11:20















            sudo -l return : (ALL : ALL) ALL
            – Adrian Maire
            Feb 26 at 11:20




            sudo -l return : (ALL : ALL) ALL
            – Adrian Maire
            Feb 26 at 11:20


            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?