Log in to your server using PuTTY. Once connected, you’ll see a small window that resizes to display your Linux server login prompt. After entering the correct credentials, you’ll be able to see the main system prompt for Linux. Linux can be a multi-user. This means that other users could also be logged in to the server. This is one advantage to Linux in a network environment. Multiple users can log in and access the server’s resources. Different roles may be assigned to users, such as administrator or user. Your rights as an ssh client will only be granted to your specific user accounts. It is not a good idea for root users to log in. You may not want the root user or superuser account to make changes. For everyday tasks, it is best to use a regular account. Depending on which distribution you are using, you may be able to execute the following command: This command allows administrative tasks to be performed without admin privileges. A prompt will appear asking for your password. Until you log out, administrator privileges will be granted to accounts that are on the “Sudo Su” list.
Now, the public and private key files are created in the directory /.ssh/ of the user that you are currently logged into. Now we need to copy and paste the public key into the authorized_keys folder on the VPS. Copy the contents of the ~/.ssh/id_rsa.pub file and paste them into the /root/.ssh/authorized_keys file on the VPS (create the file if it does not exist). Next, we need to configure the SSH service for the VPS so that key-based access is only allowed. Edit the /etc/ssh/sshd_config file and set the PasswordAuthentication parameter to no. You must restart the SSH server to make the changes effective (normally /etc/init.d/sshd reboot). You should not close your current SSH console window until you confirm that you are able to connect to the SSH server using your key/passphrase. You can access the server by connecting to SSH using the client that you have created the SSH private/public key pair. Once you are prompted, enter your passphrase. You must copy the private key to any computer other than the one where you created the key pair. You should copy the key to the directory /.ssh/ if you are using Linux. You should use another ssh client, and follow the instructions from the vendor.
After logging out, your account will be restored to normal. After you have gained access, shell commands can be used to control and navigate your server. The “flavor of shell” used by your system will determine the commands you use. Linux users will most likely use the “bash”, but you could also use the “dash.” shell. On the server machine, you should keep your public key file which is /home/gcagrici/.ssh/id_rsa.pub in our example from our previous steps. You should also copy your private keys file to each client machine you intend to connect to the remote server. Then, delete the file from the server machine. After configuring the server machine (test1 for our example), the private key file can be moved to the client machine (test2 for our example). The private key file (id_rsa), should be located under the.ssh directory on your client machine. This file must only be readable by you and not anyone else.