ops102:ssh
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
ops102:ssh [2024/01/15 12:52] – created chris | ops102:ssh [2024/04/16 18:10] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 20: | Line 20: | ||
The most basic use of SSH is for a text-based connection used to enter commands and view command output, or execute a text-based application such a menu-driven system. | The most basic use of SSH is for a text-based connection used to enter commands and view command output, or execute a text-based application such a menu-driven system. | ||
- | Some SSH clients have a graphical interface. For those used from the command line, the most basic form of invocation is: | + | Some SSH clients have a graphical interface. For OpenSSH and others |
< | < | ||
Line 47: | Line 47: | ||
* Run '' | * Run '' | ||
- | ====== | + | ===== |
- | SSH is capable of carrying graphical traffic | + | If you' |
- | + | ||
- | To enable this, add the '' | + | |
- | + | ||
- | + | ||
- | ===== Example | + | |
- | * Run Firefox | + | |
- | + | ||
- | + | ||
- | ====== | + | |
- | + | ||
- | In addition to X11 tunnelling, SSH permits you to set up your own tunnels to carry arbitrary network traffic either from the client system to the server, or from the server to your client. This allows you to encrypt the traffic for security/ | + | |
- | + | ||
- | For local, forward (client to server) tunnels, the syntax is: | + | |
< | < | ||
- | ssh -L // | + | Host " |
- | + | | |
- | Where: | + | user " |
- | * // | + | |
- | * // | + | |
- | | + | |
- | For reverse | + | Once you have added these lines (inserting your user ID where appropriate) and set the permission on that file (on Linux, '' |
< | < | ||
- | | + | |
- | + | ||
- | The arguments have the same meaning, but are executed one the opposite hosts, so the tunnel listens on the server and communicates to the destination through the client system. | + | |
- | + | ||
- | + | ||
- | ===== Examples | + | |
- | + | ||
- | * To connect port 8080 on the local computer to port 80 on the server //winter//, using the account //sam//: '' | + | |
- | * After the tunnel above was put in place, you could access '' | + | |
- | * To connect port 2000 on the local computer to port 1234 on the host //spring//, which is on the same LAN as the SSH server //winter//: '' | + | |
- | * To connect port 3000 on the server //winter// to port 5900 on the local computer: '' | + | |
+ | You can similarly configure simplified access in most other SSH client programs. | ||
====== | ====== | ||
SSH provides two mechanisms for file transfer: //scp// and //sftp//. You can use these from the command line using the OpenSSH software (installed by default in most MacOS, Windows, and Linux systems) or you can use a graphical tool that uses these protocols. | SSH provides two mechanisms for file transfer: //scp// and //sftp//. You can use these from the command line using the OpenSSH software (installed by default in most MacOS, Windows, and Linux systems) or you can use a graphical tool that uses these protocols. | ||
- | |||
- | The following instructions are for using the OpenSSH version of scp/sftp from the command line: | ||
===== scp - Secure Copy ===== | ===== scp - Secure Copy ===== | ||
- | The //scp// command functions like the normal Unix/Linux copy (cp) command, but accepts a hostname (and optional user ID) prepended to a filename for copying to/from remote systems: | + | The '' |
< | < | ||
- | scp [[//user//@]]//host//://sourcefilename// [[// | + | |
- | + | ||
- | The options are the same as for the ssh command, except that to specify a port number, use < | + | or |
- | + | ||
- | For example: | + | |
+ | < | ||
+ | scp sourcefilename user@host: | ||
+ | | ||
==== Examples | ==== Examples | ||
Line 110: | Line 84: | ||
* Copy the file '' | * Copy the file '' | ||
+ | ===== Graphical File Management over SSH ===== | ||
- | ===== | + | Many graphical file managers, such as the GNOME // |
- | //sftp// provides an encrypted version of FTP. The command usage is: | + | For example, on GNOME, you can select the menu option Places> |
- | + | ||
- | < | + | |
- | sftp [[// | + | |
- | + | ||
- | At which point you can use any standard FTP command. | + | |
- | + | ||
- | + | ||
- | ==== Example | + | |
- | + | ||
- | * Open a secure FTP connection to the account // | + | |
- | + | ||
- | + | ||
- | ===== Graphical File Management over SSH ===== | + | |
- | + | ||
- | Many Linux graphical file managers, such as the GNOME // | + | |
====== | ====== | ||
Although SSH can be used with passwords, a sysadmin may need to initiate hundreds of SSH connections a day, and typing passwords that often is tedious. SSH therefore permits authentication using public and private keys. | Although SSH can be used with passwords, a sysadmin may need to initiate hundreds of SSH connections a day, and typing passwords that often is tedious. SSH therefore permits authentication using public and private keys. | ||
- | |||
===== Background: Public Key Cryptography | ===== Background: Public Key Cryptography | ||
See [[Public Key Cryptography]] for an overview of how this technology works. | See [[Public Key Cryptography]] for an overview of how this technology works. | ||
- | |||
===== Using Public Keys with SSH ===== | ===== Using Public Keys with SSH ===== | ||
- | |||
==== Creating a Public/ | ==== Creating a Public/ | ||
Line 150: | Line 107: | ||
* Answer the questions asked by ssh-keygen. Use default values for most questions. The use of a passphrase is **strongly** recommended. Avoid changing the filename from the default (unless there is a really good reason), because the location, name, and permission of keys is critical. | * Answer the questions asked by ssh-keygen. Use default values for most questions. The use of a passphrase is **strongly** recommended. Avoid changing the filename from the default (unless there is a really good reason), because the location, name, and permission of keys is critical. | ||
* ssh-keygen will produce two files: | * ssh-keygen will produce two files: | ||
- | | + | |
- | - < | + | - '' |
A note on key type and length: ssh-keygen can generate multiple types of keys, including rsa, dsa, ecdsa, and ed25519. Any of these types serves the same purpose, and rsa/dsa can be generated with varying key lengths. The longer the key, the more difficult it is to break the key by guessing it (trying successive values until the right key is found) - each bit added to the key doubles the number of possible key values. Key lengths of 1024-4096 bits are considered reasonably secure; as computers become faster, key lengths should be increased. Better yet, use the ed25519 eliptic curve option, which is considered the most secure format supported by the current OpenSSH implementation (8.4 as of the time of writing). | A note on key type and length: ssh-keygen can generate multiple types of keys, including rsa, dsa, ecdsa, and ed25519. Any of these types serves the same purpose, and rsa/dsa can be generated with varying key lengths. The longer the key, the more difficult it is to break the key by guessing it (trying successive values until the right key is found) - each bit added to the key doubles the number of possible key values. Key lengths of 1024-4096 bits are considered reasonably secure; as computers become faster, key lengths should be increased. Better yet, use the ed25519 eliptic curve option, which is considered the most secure format supported by the current OpenSSH implementation (8.4 as of the time of writing). |
ops102/ssh.1705323128.txt.gz · Last modified: 2024/04/16 18:10 (external edit)