我正在使用scp命令将文件从本地计算机(ArchLinux)复制到我的服务器(CentOS 6.5) 。
但是,对于每个scp命令build立一个新的连接,虽然我使用SSH密钥进行身份validation,但是这个过程花费了很多时间。
那么,有没有办法维持连接,并通过它进行多次传输?
没有人趁机完成答案,我没有find任何重复,所以我们走了。
您可以使用以下选项设置~/.ssh/config :
Host machine1 HostName machine1.example.org User yourusername IdentityFile ~/.ssh/id_rsa-something ControlPath ~/.ssh/controlmasters/%r@%h:%p ControlMaster auto ControlPersist 10m
然后确保你mkdir ~/.ssh/controlmasters/起,你连接到machine1将会持续10分钟,这样你就可以在一次连接中发出更多的会话或数据传输。