生成密钥(需要在宿主机安装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
网友评论