1. Log in to server A
//使用SSH协议登录Linux系统
ssh [email protected]
2. Create ssh related directories
mkdir ~/.ssh
3. Set ssh permissions
chmod 700 ~/.ssh
4. Generate RSA public key
//请一直回车,直至提示结束
ssh-keygen -t rsa
5. Append the public key (file named id_rsa.pub) to the authentication file (file named authorized_keys):
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
6. Set the permissions of the authentication file
chmod 600 ~/.ssh/authorized_keys
7. scp The name of the file to be copied User name of server B @IP: The path to be stored on server B
//拷贝文件: 如:
scp install.log [email protected]:/home/
//或:
scp install.log 192.168.33.111:/home/
//拷贝目录: 如:
scp -r apps [email protected]:/home/
//这里的apps是目录名