Mac下 Terminal & iTerm2 SSH 免密登陆
terminal
The new Windows Terminal and the original Windows console host, all in the same place!
项目地址:https://gitcode.com/gh_mirrors/term/terminal

·
一、修改服务器配置
1、先登录服务器然后修改服务器配置
[root@iZuf6d9y2x6c8r92unymr1Z pubkey]# vim /etc/ssh/sshd_config
#找到以下内容,去掉前面的注释(#)
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
#重启sshd服务
[root@iZuf6d9y2x6c8r92unymr1Z pubkey]# service sshd restart
二、修改MAC本地配置
2、修改本地配置
qierkang@erkangMacPro # ssh-keygen -t rsa
#一路回车即可。默认在~/.ssh 目录生成两个文件:
#id_rsa :私钥 id_rsa.pub :公钥
#将本地公钥复制到服务器
qierkang@erkangMacPro # scp ~/.ssh/id_rsa.pub root@你的公网IP:/home/pubkey/id_rsa.pub
#在服务器端将公钥文件导入认证文件中
[root@iZuf6d9y2x6c8r92unymr1Z pubkey]# cat /home/pubkey/id_rsa.pub >> ~/.ssh/authorized_keys
[root@iZuf6d9y2x6c8r92unymr1Z pubkey]# chmod 700 ~/.ssh
[root@iZuf6d9y2x6c8r92unymr1Z pubkey]# chmod 600 ~/.ssh/authorized_keys
#最后一步 修改 mac 下的配置文件~/.ssh/config (没有则创建)
qierkang@erkangMacPro # vim ~/.ssh/config
#添加这些内容
Host myprod ### 别名
Hostname 192.168.xx.xx ###公网
IP Port 22 ###端口
User root ###登录账号
IdentityFile ~/.ssh/id_rsa ###本机私钥地址
最终效果如下:




The new Windows Terminal and the original Windows console host, all in the same place!
最近提交(Master分支:6 个月前 )
b8ff95d6
- Remove duplicated entries.
- Fix whitespace.
Co-authored-by: João Guerra <joca-bt@users.noreply.github.com> 15 天前
f28f6587
20 天前
更多推荐
所有评论(0)