首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使ssh忽略.ssh/config?

如何使ssh忽略.ssh/config?
EN

Unix & Linux用户
提问于 2014-01-21 18:28:52
回答 2查看 38.3K关注 0票数 65

我在我的~/..ssh/config中有以下内容。

代码语言:javascript
复制
HOST 10.2.192.*
        USER foo
        PreferredAuthentications publickey
        IdentityFile ~/.ssh/foo/id_rsa

以上配置允许我在输入一半单词时连接到一台机器。

代码语言:javascript
复制
 ssh 10.2.192.x

在ssh配置之前,我必须输入以下所有内容:

代码语言:javascript
复制
 ssh foo@10.2.192.x -i ~/.ss/foo/id_rsa

但是,10.2.192.x子网中有一台机器,我想用基于密码的身份验证来连接,而不是基于密钥的身份验证。

因为ssh查看我的配置文件并找到了PreferredAuthentications publickey的匹配项,所以我无法只使用我的密码登录。

我不打算把ssh放到这个特殊的雪花vm中,经常需要在我的ssh配置中添加一个新规则。

如何使ssh只忽略我的配置文件一次,并允许我使用密码进行身份验证?

EN

回答 2

Unix & Linux用户

回答已采纳

发布于 2014-01-21 18:35:28

若要使ssh客户端忽略配置文件,请使用ssh -F /dev/null username@example.com。因为您的子网的IdentityFile是在~/.ssh/foo而不是~/.ssh/中,所以您不需要编写一个全新的文件来避开现有的私钥。

来自ssh手册页:

代码语言:javascript
复制
 -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.
票数 84
EN

Unix & Linux用户

发布于 2014-01-21 18:58:16

我相信如何强迫ssh客户端只使用密码?已经回答了这个问题

代码语言:javascript
复制
ssh -o PubkeyAuthentication=no example.com
票数 25
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/110283

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档