ssh命令密碼參數_作爲SSH參數運行命令時如何使密碼不可見?

ssh命令密碼參數

ssh命令密碼參數

keep-passwords-invisible-when-running-a-command-as-an-ssh-argument-00

Keeping our passwords well secured is something that we all need to take seriously, but what do you do if a particular program or app displays your password in plain sight as you are typing it? Today’s SuperUser Q&A post has the solution to a frustrated reader’s password problem.

保持密碼安全性是我們所有人都必須認真對待的事情,但是,如果某個特定的程序或應用在鍵入密碼時能清楚看到密碼,您該怎麼辦? 今天的「超級用戶問答」帖子提供瞭解決沮喪的讀者密碼問題的方法。

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

今天的「問答」環節由SuperUser提供,它是Stack Exchange的一個分支,該社區是由社區驅動的Q&A網站分組。

問題 (The Question)

SuperUser reader user110971 wants to know how to keep passwords invisible when running a command as an SSH argument:

超級用戶閱讀器user110971想知道如何在將命令作爲SSH參數運行時使密碼不可見:

If I run this command and start typing the MySQL password, the password is visible on the screen:

如果運行此命令並開始輸入MySQL密碼,則該密碼在屏幕上可見:

How can I prevent this? If I log in through SSH and execute the MySQL command, then everything works fine.

我該如何預防? 如果我通過SSH登錄並執行MySQL命令,則一切正常。

How can you keep passwords invisible when running a command as an SSH argument?

在將命令作爲SSH參數運行時如何使密碼不可見?

答案 (The Answer)

SuperUser contributor Toby Speight has the answer for us:

超級用戶貢獻者Toby Speight爲我們提供了答案:

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不會分配tty ,因此遠程命令無法禁用echo。 您可以使用-t選項強制SSH提供tty

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.

等效選項(用於-o或用於配置文件)是RequestTTY 。 我會警告不要在配置文件中使用它,因爲它會對非交互式命令產生不良影響



Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.

有什麼補充說明嗎? 在評論中聽起來不錯。 是否想從其他精通Stack Exchange的用戶那裏獲得更多答案? 在此處查看完整的討論線程

Image Credit: Linux Screenshots (Flickr)

圖片來源: Linux屏幕截圖(Flickr)

翻譯自: https://www.howtogeek.com/280140/how-can-i-keep-passwords-invisible-when-running-a-command-as-an-ssh-argument/

ssh命令密碼參數