Secure Shell (SSH) is a protocol that allows you to securely connect to a remote system and access its resources. Here are some common SSH parameters with examples:
Parameters
-p
: This parameter is used to specify the port number to connect to on the remote server. By default, SSH uses port 22.
Example:
ssh -p 2222 user@example.com
This will connect to the remote server at example.com on port 2222.
-i
: This parameter is used to specify the path to the private key file to use for authentication.
Example:
ssh -i ~/.ssh/mykey.pem user@example.com
This will connect to the remote server at example.com using the private key file located at ~/.ssh/mykey.pem.
-l
: This parameter is used to specify the username to use when connecting to the remote server.
Example:
ssh -l myuser example.com
This will connect to the remote server at example.com using the username myuser.
-X
: This parameter is used to enable X11 forwarding, which allows you to run graphical applications remotely. Example:
ssh -X user@example.com
This will connect to the remote server at example.com and enable X11 forwarding.
-v
: This parameter is used to enable verbose mode, which provides more detailed output for troubleshooting purposes.
Example:
ssh -v user@example.com
This will connect to the remote server at example.com and enable verbose mode.
-nNT
: command is used to create a secure tunnel between a local and remote machine, allowing traffic to be forwarded securely between them.
ssh -nNTL 6379:service:6379 user@example.com -p 8080
-n
: This flag tells ssh not to execute a remote command. This is useful when you just want to create a tunnel and don't need to execute any commands on the remote machine. For example:
ssh -n user@example.com
-N
: This flag tells ssh not to start a shell or execute any commands on the remote machine. This is useful when you just want to create a tunnel and don't need to interact with the remote machine at all. For example:
ssh -N user@example.com
-T
: This flag tells ssh not to allocate a pseudo-terminal on the remote machine. This is useful when you just want to create a tunnel and don't need to interact with the remote machine's terminal.
For example:
ssh -T user@example.com
These are just a few examples of the many parameters that can be used with SSH. You can use the man ssh command to see a full list of available parameters and their descriptions.
Manage connections
ps aux | grep ssh
: list of all connections with ssh
kill PID
: kill a vpn connection
Top comments (0)