ssh and remote sudo not hiding password

Matt Brown mbrown7776 at gmail.com
Fri Nov 6 22:36:33 UTC 2009


Found this on commandlinefu.com

stty -echo; ssh HOSTNAME "sudo some_command"; stty echo

See if it does what you need.

Matt

Colin Law wrote:
> 2009/11/6 Matt Brown <mbrown7776 at gmail.com>:
>   
>> Change sudo to NOPASSWD
>>
>> You can get dangerous with sudo...
>>     
>
> I see that I can do that, but I don't like it.  It is not entering the
> password that is the problem, it is that the pwd is not hidden when I
> type it.
>
> Colin
>
>   
>> Matt
>>
>> Brent Bolin wrote:
>>     
>>> Think there is also an option in sudo to not prompt for passwd
>>>
>>> On Fri, Nov 6, 2009 at 4:03 PM, Brent Bolin <brent.bolin at gmail.com
>>> <mailto:brent.bolin at gmail.com>> wrote:
>>>
>>>    As root
>>>
>>>
>>>    On Fri, Nov 6, 2009 at 3:59 PM, Colin Law <clanlaw at googlemail.com
>>>    <mailto:clanlaw at googlemail.com>> wrote:
>>>
>>>        2009/11/6 Brent Bolin <brent.bolin at gmail.com
>>>        <mailto:brent.bolin at gmail.com>>:
>>>        > Use ssh keys
>>>
>>>        If I understand you correctly you mean that I should use keys to
>>>        prevent the necessity for entering the password at all.  In fact I
>>>        already do this.  The password is not for the ssh connection
>>>        but for
>>>        the sudo shutdown command.  How can I use ssh keys to prevent
>>>        having
>>>        to enter pwd for sudo?
>>>
>>>        Colin
>>>
>>>        >
>>>        > On Fri, Nov 6, 2009 at 3:46 PM, Colin Law
>>>        <clanlaw at googlemail.com <mailto:clanlaw at googlemail.com>> wrote:
>>>        >>
>>>        >> I can shut down a remote machine by connecting via ssh then
>>>        shutting it
>>>        >> down
>>>        >> ssh ip_address
>>>        >> <logon messages>
>>>        >> sudo shutdown -h now
>>>        >> password: (entered pwd not visible)
>>>        >>
>>>        >> and the remote machine shuts down.
>>>        >> To save typing (and brain power) I wrote a script on local
>>>        machine
>>>        >> ssh ip_addr sudo shutdown -h now
>>>        >> When I run the script it works as expected and shuts down
>>>        the remote
>>>        >> machine, but when it prompts me for the password (for the sudo
>>>        >> shutdown), the password I type is not hidden but is visible
>>>        on screen,
>>>        >> which is not good.  I am sure there is a way round this but
>>>        I have not
>>>        >> managed to find it.  Any help will be much appreciated.
>>>        >>
>>>        >> Colin
>>>        >>
>>>        >> --
>>>        >> ubuntu-users mailing list
>>>        >> ubuntu-users at lists.ubuntu.com
>>>        <mailto:ubuntu-users at lists.ubuntu.com>
>>>        >> Modify settings or unsubscribe at:
>>>        >> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>>>        >
>>>        >
>>>
>>>        --
>>>        ubuntu-users mailing list
>>>        ubuntu-users at lists.ubuntu.com
>>>        <mailto:ubuntu-users at lists.ubuntu.com>
>>>        Modify settings or unsubscribe at:
>>>        https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>>>
>>>
>>>
>>>       
>
>   




More information about the ubuntu-users mailing list