I've assumed you use Debian based linux and logon under root. If you are using other linux, change the command to yum or whatever package management system you used.
- First install ssh server.
~$apt-get install openssh-server
- Edit sshdconfig file
- Disable password authentication by putting the following line
- For keys file location, I prefer to put in file by user name
- Save the file
- Copy the public key of the users and put in /etc/ssh/keys/
- Restart the ssh demon by entering the following command
That's it! Your users need to use their private key to login to the server from now on.
Source : OpenBSD