首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用scp之类的东西但是当我已经登录时

问使用scp之类的东西但是当我已经登录时
EN

Unix & Linux用户
提问于 2014-12-09 04:11:41
回答 1查看 2.3K关注 0票数 0

我想在登录后通过ssh复制一个文件。scp所做的就是通过登录、密码、路径来复制文件。我想要的是,当我“在里面”时,能够做同样的事情,最好不用提供登录和密码:

代码语言:javascript
复制
$ 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?
EN

回答 1

Unix & Linux用户

发布于 2014-12-09 08:40:01

如果设置了控制文件,则可以重用现有的连接身份验证。来自man ssh_config:

代码语言:javascript
复制
 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中设置:

代码语言:javascript
复制
Host some-host
  ControlMaster auto
  ControlPath=/tmp/ssh-%h-%r
票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/172222

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档