User Tools

Site Tools


tutorials:remote_access

This is an old revision of the document!


Table of Contents

Remote access

SSH

ssh (SSH client) is a program for logging into a remote machine. The typical usage is ssh user@hostname, for example:

$ ssh jake@168.192.1.1

If the username is the same in the two machines (i.e., the local workstation and the remote server), the username can be omitted:

$ ssh 168.192.1.1

After you logged into the remote server via ssh, the shell runs just like you are sitting in front of the remote server. You can execute all your shell command as you normally would.

To logout once you are done:

$ exit

You will return to the shell running on your local machine, just like before you logging into the remote server.

SCP

scp copies files between hosts on a network. The typical usage is scp user@host1:file1 user@host2:file2. Similar to the example in ssh, the username can be omitted if it is the same in the two hosts; in addition, the local host can be omitted as well.

For example, to copy a file (foo.txt) from the home directory (~) to the home directory in the remote server, use:

$ scp ~/foo.txt 168.192.1.1:~

Reversely, to copy the file from the remote server back to the local workstation:

$ scp 168.192.1.1:~/foo.txt ~ 

Some commonly used options include:

  • -p: Preserves modification times, access times, and modes from the original file
  • -r: Recursively copy entire directories.

For example, to preserve the property of the file being copied, use:

$ scp -p ~/foo.txt 168.192.1.1:~

To copy an entire directory:

$ scp -r ~/foo_dir 168.192.1.1:~
tutorials/remote_access.1294728551.txt.gz · Last modified: 2011/01/11 14:49 by chkuo