sudo-project / sudo

Utility to execute a command as another user
https://www.sudo.ws
Other
1.14k stars 209 forks source link

show password in SSH session #383

Closed oditynet closed 1 week ago

oditynet commented 3 weeks ago

May be a found a error?!

 sudo --version
Sudo version 1.8.23
Sudoers policy plugin version 1.8.23
Sudoers file grammar version 46
Sudoers I/O plugin version 1.8.23

i connect to host: ssh sa@192.168.100.2 sudo -S yum install and return result:

sa@192.168.100.2's password:  (Password NOT SHOW!!!!!)

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for sa: sasa    (BUT PASSWORD SUDO is SHOW!!!!!!)
Sorry, try again.

if i do it on terminale, then passwort is NOT SHOW!


![Uploading 2024-06-14_17:56:22.png…]()
millert commented 1 week ago

This is because a) you did not ask ssh to create a pseudo-terminal for you and b) you used sudo's -S option which will read a password from standard input (not the terminal).

Without a pseudo-terminal is it not possible to disable echo. If you use ssh's -t option sudo will be able to disable echo. For example:

ssh -t sa@192.168.100.2 sudo yum install

Normally, Sudo will refuse to prompt for a password if it cannot disable echo. However, if you use the -S option (or enable the visiblepw option in sudoers) this check is disabled.

The normal behavior is:

$ ssh linux-build "sudo id"
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required