tags:

views:

612

answers:

6

What is the best way to download files to local hard drive when logged in to another computer using ssh in bash. I'm aware of sftp, but it is not convienent, e.g. it lacks tab completion of directory names. I'm using Ubuntu 8.04.1 . I don't have a public IP and would not like to setup dynamic Dynamic DNS solution.

A: 

I don't know.

I'd $ scp host:file locallocation

Ronny
A: 

As far as I know there is no simply scp-on-steroids that lets you autocomplete on remote folder-structures. If you just want to basically mount a remote folder, take a look at sshfs. Or just try mounting a remote directory with ssh://... within Nautilus.

Horst Gutmann
A: 

I actually like to use the command line SCP client. :) I do not know how it does this, but my SCP on Ubuntu (from openssh-client 1:4.7p1-8ubuntu1.2) actually does tab-completion of remote directories and files on hosts where I usually auth via public key.

hangy
+3  A: 

I'm also running Ubuntu 8.04.1, and if I type

$ scp [email protected]:.bashr<TAB>

I do indeed get tab completion (i.e. bash is sshing to my server and getting completion results from the filesystem there). Then

$ scp [email protected]:.bashrc .

copies my .bashrc from my server to the current directory on my local machine.

If you don't get this, try sudo apt-get install bash-completion, and check that your .bashrc contains the following lines (mine did by default):

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi
Sam Stokes
You also have tab completion when using scp locally.What you are doing is a bit of a waste compared to local scp [from-server] [to-local]. Both ways work though and do exactly the same.
Ronny
It doesn't waste anything that's valuable to me (such as time). And sshing onto the server and scping back to the local machine doesn't work if, as in the question asker's case, your local machine doesn't have an accessible ssh server.
Sam Stokes
A: 

ssh-xfer is what you are looking for. Once you have it set up, you can type (from within the ssh session on the remote machine):

$ ssh-xfer foo.txt

and foo.txt will magically show up on your local machine.

ephemient
A: 

How about FISH? File transfer over Shell - You can use Midnight Commander in your console:

$ sudo apt-get install mc
$ mc

Then hit F9; Right (for the Right panel) -> Shell link Type in the ssh link of the remote host. At the prompt enter machine name specify:

user@host

The system will prompt for the password (or auto login if your SSH keys are setup for that)

Now you can browse the remote filesystem, select and copy over (F5) as you wish.

Derick