设置默认的SSH密钥位置

设置默认的SSH密钥位置

Setting the default ssh key location

ssh默认会在?/ .ssh文件夹中查找其键。 我想强迫它始终在另一个位置查看。

我正在使用的解决方法是将密钥从非标准位置添加到代理中:

1
2
ssh-agent
ssh-add /path/to/where/keys/really/are/id_rsa

(在Linux和Windows上的MingW32 shell上)


如果您只是想为身份文件指向其他位置,则可以使用以下条目来修改?/ .ssh / config文件:

1
IdentityFile ~/.foo/identity

man ssh_config查找其他配置选项。


man ssh给我这个选项可能会有用。

-i identity_file
Selects a file from which the identity (private key) for RSA or
DSA authentication is read. The default is ~/.ssh/identity for
protocol version 1, and ~/.ssh/id_rsa and ~/.ssh/id_dsa for pro-
tocol version 2. Identity files may also be specified on a per-
host basis in the configuration file. It is possible to have
multiple -i options (and multiple identities specified in config-
uration files).

因此,您可以在bash配置中使用以下方式创建别名:

alias ssh="ssh -i /path/to/private_key"

我没有查看ssh配置文件,但是像-i选项一样,也可以使用别名

-F configfile
Specifies an alternative per-user configuration file. If a con-
figuration 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.


推荐阅读

    更新文件命令linux?

    更新文件命令linux?,工作,系统,地址,信息,时间,命令,目录,基础,标准,网络,lin

    linux下读取文件命令?

    linux下读取文件命令?,系统,工作,地址,数字,图片,信息,网络,命令,文件,一致,l

    linux改文件夹名命令?

    linux改文件夹名命令?,名字,软件,命令,文件,系统,目录,目标,文件名,源文件,

    linux设置命令行长度?

    linux设置命令行长度?,系统,工作,信息,地址,命令,工具,异常,管理,目录,文件,l

    linux建文件命令格式?

    linux建文件命令格式?,系统,名字,名称,时间,密码,命令,文件,文件夹,不了,数

    下载文件的命令linux?

    下载文件的命令linux?,平台,工具,服务,密码,软件,网络,位置,代理,手机,工作,

    linux命令文件传输?

    linux命令文件传输?,系统,数据,命令,文件,基本知识,源文件,目录,目标,功能,

    linux文件全选命令?

    linux文件全选命令?,电脑,系统,环境,代码,平台,服务,快捷键,文件,命令,权限,l

    linux浏览文件类命令?

    linux浏览文件类命令?,系统,信息,数据,情况,命令,标准,时间,文件,概念,管理,

    linux打包文件夹命令?

    linux打包文件夹命令?,系统,工具,管理,图片,文件,命令,位置,软件,目录,格式,l

    linux中统计文件命令?

    linux中统计文件命令?,系统,信息,数据,情况,工作,文件,时间,档案,标准,名称,L

    linux重名名文件命令?

    linux重名名文件命令?,图片,名称,名字,文件,命令,位置,代码,软件,系统,文件

    linux的建立文件命令?

    linux的建立文件命令?,名称,系统,时间,名字,命令,文件夹,位置,密码,不了,文

    linux设置代替命令?

    linux设置代替命令?,系统,地址,网络,工作,软件,工具,服务,信息,命令,别名,lin

    linux06文件命令?

    linux06文件命令?,数字,系统,工作,第一,名字,信息,管理,文件,目录,命令,linux

    linux将文件备份命令?

    linux将文件备份命令?,系统,密码,设备,软件,通讯,较大,认证,服务,数据,文件,L

    linux命令设置时区?

    linux命令设置时区?,时间,系统,国家,大陆,命令,时区,时钟,日期,指令,时分,lin

    linux扩展文件命令?

    linux扩展文件命令?,工作,地址,系统,信息,命令,目录,管理,情况,文件,标准,Lin

    linux设置命令限制?

    linux设置命令限制?,数字,情况,信息,管理,系统,最新,在线,设备,第一,发行,Lin