这个问题已经重复了很多次,我知道要将文件从 ssh 服务器复制到 mac 我应该遵循这个:
Copy the file "foobar.txt" from a remote host to the local host
$ scp your_username@remotehost.edu:foobar.txt /some/local/directory
但我想知道如何在连接到远程 ssh 后将其复制到我的本地计算机。 我的意思是在连接到 ssh 后意味着在终端中我连接到 ssh 然后我将它们复制到我的电脑。我想做的是一次连接到 ssh 并输入密码,然后进行所有操作。为什么?因为我正在编写一个用户友好的程序,它只询问一次密码,我不希望用户每次都输入或保存密码。
最佳答案
您实际上是在尝试重用现有的 ssh 连接。
将此添加到您的 ~/.ssh/config
以设置自动连接共享:
ControlMaster auto
ControlPath ~/.ssh/control:%h:%p:%r
现在,如果你这样做
scp your_username@remotehost.edu:foobar.txt /some/local/directory
如果您已经在另一个终端建立了连接,那么它不会要求您输入密码,连接会很快建立。
关于linux - 将文件从 ssh 服务器复制到 mac?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18415419/