SSH
SSH Key Setup Key Authentication with PuTTY Server-side Begin with generating proper folder permissions for .ssh
Make sure you're under the proper user before entering code
ssh-keygen Accept defaults for all prompts: [enter]
Now create an authorized keys file under the .ssh folder created, and set permissions
touch /home/<username>/.ssh/authorized_keys chmod 600 /home/<username>/.ssh/authorized_keys PuttyGen Inside of the puttygen program generate a key that will be used for connecting to the server
Under Actions heading click on Generate to generate a key pair When done, click on Save Private Key, and name it priv.ppk Manually copy and paste the public key starting from "ssh-rsa" down to the end of the key ending in "rsa-key-<numbers>" into a new file named public
Once you're done with this make sure to move a copy of the files into a new entry for KeePass
Server-side Copy the text of the public key you created, and insert it into the authorized_keys file:
vim /home/<username>/.ssh/authorized_keys Apply the key to a separate ssh session to make sure you've done everything correctly
Now to disallow root login and change other configuration for ssh:
sudo -i
- you are now under the root user
vim /etc/ssh/sshd_config
- Within the config change settings to match the following !!Remove # sign if applicable!!
- PermitRootLogin no
- PasswordAuthentication no
- UsePAM no
Finally, Restart the sshd service to enable these changes:
sudo systemctl restart sshd