我想在登录后通过ssh复制一个文件。scp所做的就是通过登录、密码、路径来复制文件。我想要的是,当我“在里面”时,能够做同样的事情,最好不用提供登录和密码:
$ ssh root@123.123.243.63
root's password:
Welcome to .....
Last login: ....
root@folder1:~# // How do I download (or upload) the files when I'm here?发布于 2014-12-09 08:40:01
如果设置了控制文件,则可以重用现有的连接身份验证。来自man ssh_config:
ControlMaster
Enables the sharing of multiple sessions over a single network
connection. When set to “yes”, ssh(1) will listen for
connections on a control socket specified using the ControlPath
argument. Additional sessions can connect to this socket using
the same ControlPath with ControlMaster set to “no” (the
default). ...
Two additional options allow for opportunistic multiplexing: try
to use a master connection but fall back to creating a new one if
one does not already exist. These options are: “auto” and
“autoask”. The latter requires confirmation like the “ask”
option.因此,如果使用选项-o ControlMaster=auto -o ControlPath=/tmp/ssh-%h-%r进行连接,则第一个连接可以用于scp。这可以在您的~/.ssh/config中设置:
Host some-host
ControlMaster auto
ControlPath=/tmp/ssh-%h-%rhttps://unix.stackexchange.com/questions/172222
复制相似问题