
Dagens Spørsmål & Svar-sesjon kommer til oss med høflighet av SuperUser-en underavdeling av Stack Exchange, en fellesskapsdrevet gruppering av Q & A-nettsteder.
Spørsmålet
SuperUser-leser user110971 ønsker å vite hvordan du holder passord usynlig når du kjører en kommando som et SSH-argument:
If I run this command and start typing the MySQL password, the password is visible on the screen:
- ssh user@server ‘mysql -u user -p’
How can I prevent this? If I log in through SSH and execute the MySQL command, then everything works fine.
Hvordan kan du holde passord usynlig når du kjører en kommando som et SSH-argument?
Svaret
SuperUser-bidragsyter Toby Speight har svaret for oss:
If you provide a remote command to run, SSH does not allocate a tty, so the remote command is unable to disable echo. You can force SSH to provide a tty using the -t option:
- ssh -t user@server ‘mysql -u user -p’
The equivalent option (for -o or for the config file) is RequestTTY. I would caution against using it in the config file because it can have unwanted effects for non-interactive commands.
Har du noe å legge til forklaringen? Lyder av i kommentarene. Vil du lese flere svar fra andre tech-savvy Stack Exchange-brukere? Sjekk ut hele diskusjonstråden her.
Bilde Kreditt: Linux Skjermbilder (Flickr)