SecureShell – SSH
Description
Section titled “Description”- TCP/IP port
22 sshd‑ ssh server- package
openssh-server - default sshd server config
/etc/ssh/sshd_config
- package
ssh‑ ssh client- package
openssh-client - default ssh client config
/etc/ssh/ssh_configor~/.ssh/config
- package
# -v = verbose mode for debugging# -4 = forces IPv4# -6 = forces IPv6# -i = specify the identity private key# -p = portssh user@HOSTssh -i private_key_file user@HOSTssh HOST # if the ssh keys are already copied in the server- Generating the SSH keys ‑
ssh-keygen
# -t = type of key, dsa, ecdsa, ecdsa-sk, ed25519, ed25519-sk, rsa, rsa-sha2-512(DEFAULT)# -b = Key length# -f = Specify file to write to# -C = commentssh-keygen -t rsa -b 4096ssh-keygen -t ed25519- Securely copying public SSH keys ‑
ssh-copy-id
# -i = Specify the ssh key file# -p = Port to loginssh-copy-id -i ~/.ssh/id_rsa.pub user@HOSTscp&sftp- SSH Tunneling
# Any traffic send in the local machine 3306 is forwarded to 5432 port in the remote machinessh -L [local_port]:[destination_server_ip]:[remote_port] [username]@[hostname_or_IP]ssh -L 3306:10.10.10.10:5432 user@hostname
# Remote port forward (any request direct in the remote machine port 3306 is forwarded to local machine 5432)ssh -R [remote_port]:localhost:[local_port ssh_server_hostname]ssh –R 3306:10.10.10.10:5432 user@hostnameOptions
Section titled “Options”| Options | Description |
|---|---|
| -i | specify private key, when doing key-based auth |
| -p | SSH port (default 22) |
| -v | enable verbose logging |
| -C | enable compression |
| -p | SSH port (default 22) |
Installation
Section titled “Installation”| Distro/OS/Package Manager | Install Instruction |
|---|---|
| Centos/fedora(dnf, microdnf, rpm, yum) | yum install openssh openssh-server |
| Debian/ubuntu | apt install openssh-server openssh-client |
| Arch (pacman) | pacman -Sy openssh |
| Alpine (apk-docker) | apk add openssh |