I took the following steps:
1) I created an SSH-2 RSA key pair with puttygen (Putty Key Generator)
2) I secured the private key with a password, and I downloaded both keys to a folder on a Windows 7 machine
3) I uploaded the PUBLIC key to /home/user_one through Filezilla / sftp, as filename "public_key"
4) I run the following commands on the CentOS7 machine (as user_one)
Code:
mkdir .ssh
mv public_key .ssh
chmod 700 ~/.ssh
cat public_key >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
restorecon -Rv ~/.ssh
5) I run the following
Code:
nano /etc/ssh/sshd_config
PubkeyAuthentication yes
AuthorizedKeyFile .ssh/authorized_keys
PasswordAuthentication yes (I left it as is for now, I was going to change it later, when the key authentication works)
Code:
systemctl reload httpd.service
6) I went into Putty, and I entered the following info
IP address to connect to (my server's IP)
custom port that I set for the SSH
I went to Connection -> SSH -> Auth in Putty, and I added the private.pph that was created through the Browse... button in this menu
I then went to Session -> Open
I get:
login as: user_one
Server refused our key
password:
I can enter the user's password and log in, but keys dont work.
I was trying to create the key pair on the server too, with
Setting this up should not be difficult, but something is not done correctly here...