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
>> screen.
>>
>> ie
>>
>> ssh [EMAIL PROTECTED] "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 [EMAIL PROTECTED] -t "sudo ......"
The -t says allocate a TTY, which is what sudo needs to correctly read your
password.
(Of course if what you want is to not have to type a password at all, then
James'
suggestions are all good.)
Cheers,
Benno
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html