SSH - 在不打开单独的SFTP会话的情况下传输文件的方式? [英] SSH - a way to transfer files without opening a separate SFTP session?

查看:212
本文介绍了SSH - 在不打开单独的SFTP会话的情况下传输文件的方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不是一个真正的编程问题,但与许多程序员有关... ...

假设我已经打开了一个SSH会话到另一台计算机。


remote:html avalys $ ls

welcome.msg index.html readme.txt

remote:html avalys $

是否有任何命令可以在我的远程shell中键入,并立即传输当前目录中的一个文件(例如welcome .msg)到我的本地计算机,即


remote:html avalys $ stransfer welcome.msg

正在获取/ home /avalys/html/welcome.msg至welcome.msg

/home/avalys/html/welcome.msg 100%23KB 23.3KB / s 00:00

remote:html avalys

我知道这样做的唯一方法是在SSH会话中打开并行SFTP会话和CD到当前目录,这是一个真正的PITA远程管理服务器时。



编辑:我是意识到使用反向sftp / scp连接的可能性,但涉及更多的打字。如果我可以输入一些命令的名字(例如stransfer)以及我想传输的文件,并且只是工作,那将是非常好的。

你可以设置这样一个反向传输连接w / ssh -Rport:127.0.0.1:22 user @ host for scp back。



使用scp user @ host:port 来访问它。


Not really a programming question, but relevant to many programmers...

Let's say I have opened an SSH session to another computer.

remote:html avalys$ ls
welcome.msg index.html readme.txt
remote:html avalys$

Is there any command that I can type in my remote shell that will immediately transfer one of the files in the current directory (e.g. welcome.msg) to my local computer, i.e.

remote:html avalys$ stransfer welcome.msg
Fetching /home/avalys/html/welcome.msg to welcome.msg
/home/avalys/html/welcome.msg 100% 23KB 23.3KB/s 00:00
remote:html avalys$

The only way I know of to do this is to open a parallel SFTP session and CD to my current directory in the SSH session, which is a real PITA when administering a server remotely.

EDIT: I am aware of the possibility of using a reverse sftp/scp connection, but that involves more typing. It would be great if I could type just the name of some command (e.g. "stransfer"), and the file(s) I want transferred, and have it Just Work.

解决方案

You could set up such an inverted transfer connection w/ ssh -Rport:127.0.0.1:22 user@host for scp back.

Use scp user@host:port to access it.

这篇关于SSH - 在不打开单独的SFTP会话的情况下传输文件的方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆