SSH Flashcards
SSH config file
~/.ssh/config
~/.ssh/config
Must be readable and writable only by the user
Make ~/.ssh/config readable and writeable
chmod 600 ~/.ssh/config
SSH client reads its configuration in the following precedence order:
Options specified from the command line.
Options defined in the ~/.ssh/config
Options defined in the /etc/ssh/ssh_config
SSH config files: /etc/ssh/ssh_config
/etc/ssh/ssh_config
~/.ssh/config
ssh port:
Port 22
Change ssh default port:
- # sudo vim /etc/ssh/sshd_config
- Search for line with Port 22, remove the hash # and enter the new SSH port number.
Port 5522 - # sudo systemctl restart sshd
- # ss -an | grep 5522
Update ssh allowing login without password /passphrase
# ssh-agent bash # ssh-add ~/.ssh/id_rsa
Add keygen at 4096
ssh-keygen -t rsa -b 4096
Create ssh rsa key
ssh-keygen -t rsa
Create and copy ssh key
- ssh-keygen -t rsa -b 4096
- ssh-copy-id user@172.980.34.200
- ssh user@IP
Disable rootlogin
Step 1: # vi sshd_config
Step 2: Find: PermitRootLogin yes
change to: # PermitRootLogin
Step 3# systemctl restart sshd