tutorials:remote_access
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorials:remote_access [2011/01/11 14:49] – chkuo | tutorials:remote_access [2019/01/11 17:35] (current) – [Key] chkuo | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Remote access ====== | ====== Remote access ====== | ||
- | ===== ssh ===== | + | ===== SSH ===== |
- | '' | + | |
- | <code bash> | + | |
- | $ 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: | + | ==== Login ==== |
- | <code bash> | + | '' |
- | $ ssh 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: <code bash>ssh 168.192.1.1</ |
+ | |||
+ | **Note**: when connecting to a remote host for the first time, expect to see a warning about the authenticity of the host can't be established. Simply type '' | ||
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. | 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: | + | ==== Logout ==== |
- | <code bash> | + | To logout once you are done, type: <code bash> |
- | $ exit | + | |
- | </ | + | |
You will return to the shell running on your local machine, just like before you logging into the remote server. | You will return to the shell running on your local machine, just like before you logging into the remote server. | ||
+ | ==== Key ==== | ||
+ | To generate key-pairs, use: <code bash> | ||
- | ===== scp ===== | + | This command will create a pair of private key ('' |
- | '' | + | |
- | For example, to copy a file (foo.txt) from the home directory | + | If the home directory |
- | <code bash> | + | For example (see [[https://help.ubuntu.com/ |
- | $ scp ~/foo.txt 168.192.1.1:~ | + | * set up '' |
- | </code> | + | * in ''/ |
+ | * restart sshd: '' | ||
- | Reversely, to copy the file from the remote server back to the local workstation: | + | ==== Keep alive ==== |
- | < | + | To prevent |
- | $ scp 168.192.1.1: | + | < |
+ | ServerAliveInterval 60 | ||
+ | ServerAliveCountMax 60 | ||
</ | </ | ||
+ | This sends a signal every 60 seconds for a maximum of 60 times (one hour) from the client to the server. | ||
+ | |||
+ | If you do not have the permission to make this modification, | ||
+ | |||
+ | |||
+ | ===== SCP ===== | ||
+ | '' | ||
+ | |||
+ | 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 (~) of the local workstation to the home directory in the remote server, use: <code bash>scp ~/foo.txt 168.192.1.1: | ||
+ | |||
+ | Reversely, to copy the file from the remote server back to the local workstation, | ||
Some commonly used options include: | Some commonly used options include: | ||
Line 39: | Line 52: | ||
* '' | * '' | ||
- | For example, to preserve the property of the file being copied, use: | + | For example, to preserve the property of the file being copied, use: <code bash>scp -p ~/foo.txt 168.192.1.1: |
- | <code bash> | + | |
- | $ scp -p ~/foo.txt 168.192.1.1: | + | |
- | </ | + | |
- | + | ||
- | To copy an entire directory: | + | |
- | <code bash> | + | |
- | $ scp -r ~/foo_dir 168.192.1.1: | + | |
- | </ | + | |
+ | To copy an entire directory, use: <code bash>scp -r ~/foo_dir 168.192.1.1: |
tutorials/remote_access.1294728566.txt.gz · Last modified: by chkuo