我的 ~/.ssh/config 中有以下内容。
HOST 10.2.192.*
USER foo
PreferredAuthentications publickey
IdentityFile ~/.ssh/foo/id_rsa
Run Code Online (Sandbox Code Playgroud)
上面的配置让我在输入一半的单词的同时连接到一台机器。
ssh 10.2.192.x
Run Code Online (Sandbox Code Playgroud)
在我的 ssh 配置之前,我必须输入所有这些:
ssh foo@10.2.192.x -i ~/.ss/foo/id_rsa
Run Code Online (Sandbox Code Playgroud)
但是,我想使用基于密码的身份验证而不是基于密钥的身份验证连接到 10.2.192.x 子网中的一台机器。
因为 ssh 查看我的配置文件并找到匹配项,PreferredAuthentications publickey
因为我无法仅使用我的密码登录。
我不打算经常 ssh 进入这个特殊的雪花虚拟机,以保证向我的 ssh 配置添加新规则。
我怎样才能让 ssh 忽略我的配置文件一次,并允许我使用密码进行身份验证?
Dop*_*oti 77
要让您的ssh
客户端忽略您的配置文件,请使用ssh -F /dev/null username@example.com
. 因为您的子网的 IdentityFile 位于~/.ssh/foo
而不是 中~/.ssh/
,所以您无需创建一个全新的文件来避开现有的私钥。
从ssh
手册页:
-F configfile
Specifies an alternative per-user configuration file. If a
configuration file is given on the command line, the system-wide
configuration file (/etc/ssh/ssh_config) will be ignored. The default
for the per-user configuration file is ~/.ssh/config.
Run Code Online (Sandbox Code Playgroud)
And*_*ern 24
我相信这个问题已经得到了回答:How to force ssh client to use only password auth?
ssh -o PubkeyAuthentication=no example.com
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
35761 次 |
最近记录: |