02-配置SSH免密登录

2020-08-21  本文已影响0人  d4peng

生成密钥(需要在宿主机安装git软件)

cd ~
git config --global user.name "d4peng"
git config --global user.email "d4peng@outlook.com"
ssh-keygen -t rsa -C "d4peng@outlook.com"
cat ~/.ssh/id_rsa.pub

配置SSH免密登录

ssh-copy-id -i ~/.ssh/id_rsa.pub root@xx.xx.xx.xx -p 22
ssh root@xx.xx.xx.xx -i ~/.ssh/id_rsa.pub

配置alias永久生效

echo 'alias svr="ssh root@xx.xx.xx.xx -i ~/.ssh/id_rsa"' >> .zshrc
上一篇 下一篇

猜你喜欢

热点阅读