Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I SSH with a remote server so I can browse files and edit them. I have a username and password to use.

share|improve this question
up vote 43 down vote accepted

SSH comes by default in all Ubuntu versions so you save in having to install it (+1 for having it already there ;) )

Except of course in the case where you want a SSH server for your Ubuntu server. In that case you would

sudo apt-get install openssh-server 

which should make your computer/server ready to be a ssh server.

To use it is fairly easy:

ssh USER@SITE for example if my username is cyrex and the site is then you would do this:


Now lets say you want to copy a file called bubblegum.txt from your computer to your ubuntu site and want to leave that file at the /var/www folder in the ubuntu site. you can do this (assuming your user has enough permissions in the ubuntu site) by using SSH's Brother, SCP (Which also comes by default in Ubuntu):

scp bubblegum.txt 

Notice the : between the USER@SITE and the folder where you want to copy it. It is the one that separates both elements.

Now lets say you are uploading some huge file with scp and then the worst happens, the world explodes. How can you keep on uploading that file to the server. Then you got SCP's big brother, rsync (Comes by default in Ubuntu). In many ways scp and rsync do the same thing but here are some big differences between them:

  • rsync can upload partial files left from rsync or scp after a disconnection or world domination.
  • rsync can show the progress much better than scp
  • rsync can optimize the upload in such a way that you can actually save seconds or minutes on the upload. It also shows at the end of the upload how much you have saved.

Anyway, in the case scp could not upload the entire file this is where rsync comes in to rescue. (Thanks to Marco Ceppi for the tip. Vote up his comment if you like cats.. and/or dogs)

Lets say you did the upload mention above from scp and it got to 60%. How can you continue in that 60% without losing your times worth for the upload. You would do this:

rsync --progress --partial bubblegum.txt  

This tells rsync to show the progress in a nice human readable way with the --progress flag. It also tells rsync to check and continue from where the file bubblegum.txt got to with the --partial flag. You can also simplify the amount to write with the -P parameter which is the same as --progress and --partial, so the above would look like this:

rsync -P bubblegum.txt  

You can even CTRL+C the upload and resume it by doing the command from rsync above. Very cool to have the ability to resume something anytime any amount of times.

For more info for rsync which comes by default with Ubuntu you can type the following terminal commands:

man rsync  
info rsync  
rsync --help

Now to specify a port for SSH. To specify it you can do it like this:

ssh -p PORT. For example: ssh -p 1234 to tell it to use Port 1234 for the SSH service. This has to be configured in the server first for it to work.

To configure it just open in the server the file ssh_config like this: nano /etc/ssh/ssh_config and change the line that says # port 22 to another port. Also remember to remove the comment from that line. It should look like this: port 1234 in the case for the example above.

Now just restart the ssh service in the server and you are done. To restart the service just do this:

sudo restart ssh` or `sudo /etc/init.d/ssh restart

NOTE - You can also use SSH from GUI tools like filezilla which offer the option to use ssh instead of ftp. ssh can also be accessed from within the Ubuntu menu:

enter image description here

which gives access to several options including Windows share, SSH and FTP:

enter image description here

For more information about SSH you can use one of the following commands in console in your Ubuntu box:

man ssh  
info ssh  
ssh --help
share|improve this answer

If you want to browse the server through Nautilus like you do with files on your local machine:

  1. Open Nautilus ("Home Folder")
  2. Go to "File" --> "Connect to Server"

    Connect to server

  3. Select "SSH" under "Service Type"

  4. Put the IP address or domain under "Server"

    Select SSH

  5. Add your username and check "Add bookmark" if you want the location saved to your bookmarks.

The folder should open right up for you.

share|improve this answer
On Kubuntu one can do the same with Krusader. – Adobe Nov 4 '11 at 19:30

You could use sshfs to mount a remote directory to your local filesystem.


Command-line Usage

Now, assuming that you have an SSH server running on a remote machine, simply run the SSHFS command to mount the remote directory. In this example, the remote directory is /projects on remote host far. The local mount point is ~/far_projects.

mkdir ~/far_projects
sshfs -o idmap=user $USER@far:/projects ~/far_projects

To unmount,

fusermount -u ~/far_projects

To add it to your /etc/fstab,

sshfs#$USER@far:/projects /home/$USER/far_projects fuse defaults,idmap=user 0 0

Note that you have to change $USER to your login name when editing fstab, but it is not necessary when typing commands (the shell does it for you in that case).

share|improve this answer

Assuming the ssh server is already set up, open a terminal and type:

ssh username@hostname

You'll be prompted for your password; just enter it. If you need a port number, add -p PORTNUM.

share|improve this answer

If you can use Vim, Pico, or etc, you can use the terminal:


Enter your password, and you are in. From there, it's just like a regular terminal, except you have no GUI.

Note, you can add the '-X' option, and if your server has an X server configured, you can run GUI programs. Just type their name if you added -X and it will launch a GUI window.

Now, you will probably want to set up passwordless login. If you have no key already, type ssh-keygen and just hit enter to all the defaults. Then do ssh-copy-id Once that's done, just type in ssh and you don't have to enter your password!

If your username is the same as your Laptop's username, you do not need MYUSER@. You can just do ssh You can also use the -l MYUSER option instead of MYUSER@

If you want a GUI, Nautilus can do this. File -> Connect to Server -> [select 'SSH', then fill in login details] -> Connect.

If you want to just copy a single file, use scp [secure copy].
scp ./

This copies the file "~/path/to/file.dat" to your current directory. Note, if you do not have a slash or tilde after the :, it will act like you are in your home directory [~/]. If you want to upload, scp ./local_file.dat That will put it in your home dir.

share|improve this answer

ssh -X -C user@host nautilus --no-desktop to go in gui mode :)

share|improve this answer
The local Nautilus can just connect to an SSH share. It is not necessary to run Nautilus remotely. I actually wouldn't recommend doing that. Creative suggestion, but still -1 – Jo-Erlend Schinstad Aug 25 '11 at 16:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.