在本机执行以下命令
cd .ssh ssh-copy-id name@xxx.xxx.xxx
2.去远程机修改权限
cd .ssh chmod 755 authorized_keys
3. 别名设置(本机执行)
cd .ssh touch config vi config
在config文件中添加如下命令
Host xxx HostName xxx.xxx.xxx.xxx Port 22 User root IdentityFile ~/.ssh/id_rsa.pub AddKeysToAgent yes
*如果出现以下问题说明权限不够
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0644 for '/home/robin/.ssh/id_rsa' are too open. It is recommended that your private key files are NOT accessible by others. This private key will be ignored. bad permissions: ignore key: /home/robin/.ssh/id_rsa
chmod 755 ~/.ssh/ chmod 600 ~/.ssh/id_rsa ~/.ssh/id_rsa.pub chmod 644 ~/.ssh/known_hosts
*如果是以下问题
Load key "/Users/liangjingxian/.ssh/id_rsa.pub": invalid format
修改config配置文件的权限
IdentityFile ~/.ssh/id_rsa
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。
评论