sudo su - anotherusername not prompting for password

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











up vote
1
down vote

favorite












I am new to Redhat linux. I am trying to run the following command and would like to know why it is not prompting for password?



Here is what I am doing. I open the terminal window and enter my username and password. After that I run the following command



sudo su - anotherusername


The command runs successfully without prompting for password of anotherusername. I want to know why I don't get password prompt?



Are there any circumstances where I will get password prompt for anotherusername?



Or Is there a different command that will prompt me for anotherusername password?



I mistakenly posted this question in StackOverflow https://stackoverflow.com/questions/46632690/sudo-su-username-not-prompting-for-password
and I was told that if my username is part of sudoers group then I will not get password prompt.



Just want to confirm if that is the only reason or there are other reasons as well for not receiving password prompt.



I will really appreciate your help.










share|improve this question



















  • 1




    Tangentially related: unix.stackexchange.com/questions/218169/…
    – Kusalananda
    Oct 8 '17 at 16:39






  • 1




    Possibly: unix.stackexchange.com/q/382060/117549
    – Jeff Schaller
    Oct 8 '17 at 17:04














up vote
1
down vote

favorite












I am new to Redhat linux. I am trying to run the following command and would like to know why it is not prompting for password?



Here is what I am doing. I open the terminal window and enter my username and password. After that I run the following command



sudo su - anotherusername


The command runs successfully without prompting for password of anotherusername. I want to know why I don't get password prompt?



Are there any circumstances where I will get password prompt for anotherusername?



Or Is there a different command that will prompt me for anotherusername password?



I mistakenly posted this question in StackOverflow https://stackoverflow.com/questions/46632690/sudo-su-username-not-prompting-for-password
and I was told that if my username is part of sudoers group then I will not get password prompt.



Just want to confirm if that is the only reason or there are other reasons as well for not receiving password prompt.



I will really appreciate your help.










share|improve this question



















  • 1




    Tangentially related: unix.stackexchange.com/questions/218169/…
    – Kusalananda
    Oct 8 '17 at 16:39






  • 1




    Possibly: unix.stackexchange.com/q/382060/117549
    – Jeff Schaller
    Oct 8 '17 at 17:04












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I am new to Redhat linux. I am trying to run the following command and would like to know why it is not prompting for password?



Here is what I am doing. I open the terminal window and enter my username and password. After that I run the following command



sudo su - anotherusername


The command runs successfully without prompting for password of anotherusername. I want to know why I don't get password prompt?



Are there any circumstances where I will get password prompt for anotherusername?



Or Is there a different command that will prompt me for anotherusername password?



I mistakenly posted this question in StackOverflow https://stackoverflow.com/questions/46632690/sudo-su-username-not-prompting-for-password
and I was told that if my username is part of sudoers group then I will not get password prompt.



Just want to confirm if that is the only reason or there are other reasons as well for not receiving password prompt.



I will really appreciate your help.










share|improve this question















I am new to Redhat linux. I am trying to run the following command and would like to know why it is not prompting for password?



Here is what I am doing. I open the terminal window and enter my username and password. After that I run the following command



sudo su - anotherusername


The command runs successfully without prompting for password of anotherusername. I want to know why I don't get password prompt?



Are there any circumstances where I will get password prompt for anotherusername?



Or Is there a different command that will prompt me for anotherusername password?



I mistakenly posted this question in StackOverflow https://stackoverflow.com/questions/46632690/sudo-su-username-not-prompting-for-password
and I was told that if my username is part of sudoers group then I will not get password prompt.



Just want to confirm if that is the only reason or there are other reasons as well for not receiving password prompt.



I will really appreciate your help.







linux shell sudo






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 9 '17 at 0:12

























asked Oct 8 '17 at 16:33









jbl

63




63







  • 1




    Tangentially related: unix.stackexchange.com/questions/218169/…
    – Kusalananda
    Oct 8 '17 at 16:39






  • 1




    Possibly: unix.stackexchange.com/q/382060/117549
    – Jeff Schaller
    Oct 8 '17 at 17:04












  • 1




    Tangentially related: unix.stackexchange.com/questions/218169/…
    – Kusalananda
    Oct 8 '17 at 16:39






  • 1




    Possibly: unix.stackexchange.com/q/382060/117549
    – Jeff Schaller
    Oct 8 '17 at 17:04







1




1




Tangentially related: unix.stackexchange.com/questions/218169/…
– Kusalananda
Oct 8 '17 at 16:39




Tangentially related: unix.stackexchange.com/questions/218169/…
– Kusalananda
Oct 8 '17 at 16:39




1




1




Possibly: unix.stackexchange.com/q/382060/117549
– Jeff Schaller
Oct 8 '17 at 17:04




Possibly: unix.stackexchange.com/q/382060/117549
– Jeff Schaller
Oct 8 '17 at 17:04










2 Answers
2






active

oldest

votes

















up vote
2
down vote













sudo su runs su as root; thus there is no need for su to ask a password.



The question might be why sudo does not ask for a password (the invoking user's or root's). The output of sudo -l may explain that. Or sudo has been invoked before and considers the formerly entered password still valid.






share|improve this answer





























    up vote
    0
    down vote













    Try searching for the username of the user running the sudo command in /etc/sudoers:



    $ sudo grep yourusername /etc/sudoers
    yourusername ALL=(ALL) NOPASSWD: ALL


    If the output of that grep command contains NOPASSWD:, then use the visudo command to edit and remove the NOPASSWD: from that line.



    Also, you'll be prompted for the password of the user running the sudo command, not the password of the account that you're trying to login to.






    share|improve this answer






















    • sudo -iu anotherusername would be somewhat easier, though
      – roaima
      Oct 8 '17 at 20:56










    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f396868%2fsudo-su-anotherusername-not-prompting-for-password%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote













    sudo su runs su as root; thus there is no need for su to ask a password.



    The question might be why sudo does not ask for a password (the invoking user's or root's). The output of sudo -l may explain that. Or sudo has been invoked before and considers the formerly entered password still valid.






    share|improve this answer


























      up vote
      2
      down vote













      sudo su runs su as root; thus there is no need for su to ask a password.



      The question might be why sudo does not ask for a password (the invoking user's or root's). The output of sudo -l may explain that. Or sudo has been invoked before and considers the formerly entered password still valid.






      share|improve this answer
























        up vote
        2
        down vote










        up vote
        2
        down vote









        sudo su runs su as root; thus there is no need for su to ask a password.



        The question might be why sudo does not ask for a password (the invoking user's or root's). The output of sudo -l may explain that. Or sudo has been invoked before and considers the formerly entered password still valid.






        share|improve this answer














        sudo su runs su as root; thus there is no need for su to ask a password.



        The question might be why sudo does not ask for a password (the invoking user's or root's). The output of sudo -l may explain that. Or sudo has been invoked before and considers the formerly entered password still valid.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Oct 8 '17 at 17:03









        Jeff Schaller

        32.3k849109




        32.3k849109










        answered Oct 8 '17 at 16:38









        Hauke Laging

        53.7k1282130




        53.7k1282130






















            up vote
            0
            down vote













            Try searching for the username of the user running the sudo command in /etc/sudoers:



            $ sudo grep yourusername /etc/sudoers
            yourusername ALL=(ALL) NOPASSWD: ALL


            If the output of that grep command contains NOPASSWD:, then use the visudo command to edit and remove the NOPASSWD: from that line.



            Also, you'll be prompted for the password of the user running the sudo command, not the password of the account that you're trying to login to.






            share|improve this answer






















            • sudo -iu anotherusername would be somewhat easier, though
              – roaima
              Oct 8 '17 at 20:56














            up vote
            0
            down vote













            Try searching for the username of the user running the sudo command in /etc/sudoers:



            $ sudo grep yourusername /etc/sudoers
            yourusername ALL=(ALL) NOPASSWD: ALL


            If the output of that grep command contains NOPASSWD:, then use the visudo command to edit and remove the NOPASSWD: from that line.



            Also, you'll be prompted for the password of the user running the sudo command, not the password of the account that you're trying to login to.






            share|improve this answer






















            • sudo -iu anotherusername would be somewhat easier, though
              – roaima
              Oct 8 '17 at 20:56












            up vote
            0
            down vote










            up vote
            0
            down vote









            Try searching for the username of the user running the sudo command in /etc/sudoers:



            $ sudo grep yourusername /etc/sudoers
            yourusername ALL=(ALL) NOPASSWD: ALL


            If the output of that grep command contains NOPASSWD:, then use the visudo command to edit and remove the NOPASSWD: from that line.



            Also, you'll be prompted for the password of the user running the sudo command, not the password of the account that you're trying to login to.






            share|improve this answer














            Try searching for the username of the user running the sudo command in /etc/sudoers:



            $ sudo grep yourusername /etc/sudoers
            yourusername ALL=(ALL) NOPASSWD: ALL


            If the output of that grep command contains NOPASSWD:, then use the visudo command to edit and remove the NOPASSWD: from that line.



            Also, you'll be prompted for the password of the user running the sudo command, not the password of the account that you're trying to login to.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Oct 10 '17 at 1:07

























            answered Oct 8 '17 at 17:28









            L.Ray

            1968




            1968











            • sudo -iu anotherusername would be somewhat easier, though
              – roaima
              Oct 8 '17 at 20:56
















            • sudo -iu anotherusername would be somewhat easier, though
              – roaima
              Oct 8 '17 at 20:56















            sudo -iu anotherusername would be somewhat easier, though
            – roaima
            Oct 8 '17 at 20:56




            sudo -iu anotherusername would be somewhat easier, though
            – roaima
            Oct 8 '17 at 20:56

















             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f396868%2fsudo-su-anotherusername-not-prompting-for-password%23new-answer', 'question_page');

            );

            Post as a guest













































































            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?