[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Transferring files over SSH in the console



On 10-03-21 18:52:36, Dotan Cohen wrote:
> I am managing a small embedded device that I SSH into over the LAN. 
> To run commands, I use KDE Konsole, and to transfer files I use 
> Konqueror and SFTP. I understand that SFTP also runs over SSH, so is 
> there a way to send files in Konsole as well? I am familiar with the 
> FTP commands such as cd, lcd, put, and get. Are there equivalent 
> commands for SSH terminal connections?

Though your request is reasonable, I believe one can not bothe have a 
terminal and transfer files using OpenSSH's ssh command.  There might 
be something possible with port forwarding, and perhaps an escape could 
be added to ssh to provide access to the sftp subsystem, but what I 
always do is just do the transfer separately, as you do, and keep track 
of the CWD myself.

Transfers can be done from the same terminal by backgrounding the ssh 
connection and then using sftp or scp.  In ssh and bash (see "ESCAPE 
CHARACTERS" in `man ssh` and "JOB CONTROL" in `man bash`):

[ ~]# ll mime.py 
-rw-r--r-- 1 root root 16782 May 18  2009 mime.py
[ ~]# ~^Z [suspend ssh]

[1]+  Stopped                 ssh root@foo.com
[tonyn@localhost ~]$ ll mime.py
ls: cannot access mime.py: No such file or directory
[tonyn@localhost ~]$ scp root@foo.com:mime.py .
mime.py                                                                 
100%   16KB  16.4KB/s   00:01    
[tonyn@localhost ~]$ fg
ssh root@foo.com

[root@rapidxen ~]# 

You can keep sftp running and switch back and forth by "^Z" out of sftp 
and "fg %-" to go back to the "other" job, ssh.  Use the up arrow into 
command history to avoid even typing "fg %-".

Or, you could always use sftp or scp from the remote machine back to 
yours, if you open things up enough that you can ssh etc. into the 
local machine.  (I have my firewall block connections from outside the
local network, so I can do this locally but not remotely.)

p.s.  I hate screen.

-- 
____________________________________________________________________
TonyN.:'                       <mailto:tonynelson@georgeanelson.com>
      '                              <http://www.georgeanelson.com/>


Reply to: