ssh使用

在工作中,ssh登录远程机器是我们经常用的一个命令,偶尔也会使用ssh-keygen生成一下秘钥。对于ssh的使用,对于不明白的地方,我们可以使用man ssh查看各个参数的作用。

下面列举了几个常用的使用,方便日后查阅。

ssh 秘钥生成


ssh-keygen -t rsa

-t = The type of the key to generate 
密钥的类型

-C = comment to identify the key 
用于识别这个密钥的注释 

注释你可以输入任何内容,很多网站和软件用这个注释作为密钥的名字

ssh登录指定秘钥登录:

ssh -i key.pem root@192.168.1.1

ssh 别名登录(效率神器)

.ssh/config 这是配置别名的地方

Host *
      ServerAliveInterval 60
  Host denglu
      HostName 你的ip
      User mojie
      IdentityFile    ~/.ssh/你的pem文件名.pem

ssh-copy-id 将本机的公钥复制到远程机器的authorized_keys文件中,ssh-copy-id也能让你有到远程机器的home, ~./ssh , 和 ~/.ssh/authorized_keys的权利

ssh-add -L 可以通过man ssh-add 查看命令参数含义

 -L      Lists public key parameters of all identities currently represented by the agent.
  -l      Lists fingerprints of all identities currently represented by the agent.

使用详细介绍文章

https://blog.csdn.net/liu_qingbo/article/details/78383892

###ssh-add与多账户

https://segmentfault.com/q/1010000000835302

automator解决每次需要ssh-add问题

https://www.jianshu.com/p/ada03bd51ed5

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值