Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ssh-keygen -t rsa
- save generated keys to /home/user/.ssh/ directory
- will be 2 keys - id_rsa (private) and id_rsa.pub (public)
- copy pub key to the VPS:
- ssh-copy-id -i /home/user/.ssh/id_rsa.pub root@XXXXXXXXX
- after successfull copy need change SSH config on server:
- nano etc/ssh/sshd_config
- and change 'PasswordAuthentication yes' to 'PasswordAuthentication no'
- CTRL+O
- sudo systemctl restart sshd.service
- ssh -p 22 -i /key username@XX.XX.XXXX
- login to ssh with keypair.
Advertisement
Add Comment
Please, Sign In to add comment