SLUG Mailing List Archives
Re: [SLUG] sudo command over ssh - pasword echo
- To: slug@xxxxxxxxxxx
- Subject: Re: [SLUG] sudo command over ssh - pasword echo
- From: Benno <benjl@xxxxxxxxxxxxxxx>
- Date: Thu, 20 Apr 2006 10:52:59 +1000
- User-agent: Mutt/1.5.11+cvs20060126
On Thu Apr 20, 2006 at 10:46:02 +1000, James Gray wrote:
>On Thu, 20 Apr 2006 10:02 am, Simon Wong wrote:
>> I am wanting to do a command with sudo via ssh that requires a password
>> but the problem is that when I enter the password it is echoed to the
>> ssh user@host "sudo apt-get dist-upgrade"
>> password: PASSWORD-HERE
>> Is there a way to stop this being echoed or a better way to do this?
>Add "user" to the "sudo" group on "host" and you wont be prompted for the
>user's password anymore (at least that's how it works on Ubuntu and RHEL).
>Alternatively, login and run the commands interactively (but given you're
>running commands directly from ssh, I'm assuming this is actually a script?).
>If you go with the sudo group idea, you may want to setup a special user
>("updater" or something) that can only run specific commands like "apt-get"
>with sudo and even then, restrict the options that can be passed as well.
Mmm, I missed the original, but what you want is:
ssh user@host -t "sudo ......"
The -t says allocate a TTY, which is what sudo needs to correctly read your
(Of course if what you want is to not have to type a password at all, then James'
suggestions are all good.)