How can I SSH with a remote server so I can browse files and edit them. I have a username and password to use.
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
which should make your computer/server ready to be a ssh server.
To use it is fairly easy:
Now lets say you want to copy a file called
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:
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:
This tells rsync to show the progress in a nice human readable way with the
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:
Now to specify a port for SSH. To specify it you can do it like this:
To configure it just open in the server the file ssh_config like this:
Now just restart the ssh service in the server and you are done. To restart the service just do this:
NOTE - You can also use SSH from GUI tools like
which gives access to several options including Windows share, SSH and FTP:
For more information about SSH you can use one of the following commands in console in your Ubuntu box:
Assuming the ssh server is already set up, open a terminal and type:
You'll be prompted for your password; just enter it. If you need a port number, add
You could use
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.
To add it to your /etc/fstab,
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).
If you want to browse the server through Nautilus like you do with files on your local machine:
The folder should open right up for you.
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
If your username is the same as your Laptop's username, you do not need
If you want a GUI, Nautilus can do this. File
If you want to just copy a single file, use scp [secure copy].
This copies the file "~/path/to/file.dat" to your current directory. Note, if you do not have a slash or tilde after the