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

Re: Transferring files over SSH in the console

Tzafrir Cohen schreef:
While this is not what you asked for, I still prefer scp.
scp can be made much more convinient to use, once you allow tab
completion of remote file names.

 scp file.txt user@remoteMachine:/rem<tab>

This works if you cna login without a password to user@remoteMachine .
There are several ways to do that:

1. Passphrase-less key
2. key + ssh-agent

I suppose people in this list are familiar with the above two. The
down-sides with those two are:

1. They still require estabilishng an extra SSH connection per pressing
of <tab>.
2. They may require extra setup on remoteMachine.

Luckily openssh provides a better alternative. In my .ssh/config I have:

Host *
        ControlMaster = auto
        ControlPath = ~/.ssh/socket/control_%h__%p__%r__%l

This means that whenever I connect to a new host, ssh creates a socket
that allows multiplexing new ssh connections on the already-established
SSH connection. After-all the SSH protocol was designed to support
multiple streams (for e.g. port forwarding).

With this set, scp works nice and fast to a remote host. BTW: it seems
that in squeeze rsync now has the same sort of completion.

As usual, I rely on the shell's history to provide me some sort of
context. I usually also copy pathes from a remote shell window on the
target system.
Thanks, this is very neat ;)

Attachment: signature.asc
Description: OpenPGP digital signature

Reply to: