115
Steps as follow:
- Install and enable OpenSSH Server
- Generate to keys (public and private key), use puttygen.exe in Windows or ssh-keygen in Linux.
- Copy id_rsa.pub (public key) to server, and save it into .ssh folder in ssh server if this is non-admin account
- If used puttygen.exe to generate the private key, please save it (id_rsa.ppk) into safe place in local PC.
- If used ssh-keygen in Linux, please use puttygen.exe to convert the private key in to *.ppk file extension.
- Rename or copy the id_rsa.pub (public key) with filename “authorized_keys”
- Set connection from ssh client, add id_rsa.ppk (private key) on created profile
- Test to use key file to access SSH server, and make sure can use su or sudo command in linux. For Windows, please make sure RDP port forwarding is working.
- Disable password-based authentication. On Linux, vim \etc\ssh\sshd-config, and then change “PasswordAuthentication no”. On Windows, the sshd-config is locate %programdata%\ssh\ssh_config, and do the same to change “PasswordAuthentication no”.
- Option – for restricted root login, edit the same sshd-config file, to change PermitRootLogin from yes to no.
- Once all update made, restart the sshd service. For Linux, run systemctl restart sshd . For Windows machine, go to Control Panel > Administrative Tools > Services, then locate and select OpenSSH in the list of services, and click Restart.
Done.