# Secure SSH connection setup **Published by:** [cyberG|DVS](https://paragraph.com/@cyberg/) **Published on:** 2022-07-08 **URL:** https://paragraph.com/@cyberg/secure-ssh-connection-setup ## Content Hello community. I would like to share with you a guide on setting up a secure SSH connection to your server. Let's start the computer from which we will connect to the server. First thing we get is root permissions: sudo su Next, generate a private key with this command ssh-keygen Next, specify the directory in which you want to save these keys. Default directory is /root/.ssh/id_rs Enter a password for your private key.If you have already created keys, you will see this output If you choose yes, the previous keys cannot be restores, so be careful.If you've created a private key , here's what you'll seeGo to the directory ~/.ssh. The following files will be there : id_rsa and id_rsa.pub Display everything in the id-rsa.pub file cat ~/.ssh/id_rsa.pub Next go to the server: ssh user@ip Go to directory ~/.ssh mkdir -p ~/.ssh/ && cd ~/.ssh Write the public key to the authorized_keys file Create files with touch authorized_keys Replace public key with your data. echo pubkey >> ~/.ssh/authorized_keys Congratulations. Installation completed. Now you can connect securely using SSH. ## Publication Information - [cyberG|DVS](https://paragraph.com/@cyberg/): Publication homepage - [All Posts](https://paragraph.com/@cyberg/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@cyberg): Subscribe to updates - [Twitter](https://twitter.com/vadyhodler777): Follow on Twitter