本地和服务器(ubuntu)文件同步

秘钥登录远端服务器

rsync -avze 'ssh -i ./id_rsa' root@remoteIp:/xx/remotefile.txt ./localpath

(./id_rsa为本地秘钥路径)

rsync文档

用户名/密码登录远端服务器

1.从远程ubuntu主机拷贝文件/文件夹到本地(scp)

  scp -r username@remoteIp:/xxx/remotefile.txt  ./localpath   -->输入密码

2.从本地向远程ubuntu主机拷贝文件/文件夹(scp)

 scp -r localfile.txt username@remoteIp:/home/xxx/  -->输入密码

  

猜你喜欢

转载自www.cnblogs.com/brainworld/p/9156757.html
今日推荐