linux ssh login with secret key and disable password login

ssh-keygen -t rsa #-t means encryption method #The save path and short password confirmation will appear afterwards, just press Enter all the way

 

cd /root/.ssh

 

mv id_rsa.pub authorized_keys #renaming

 

Download id_rsa to local

 

Modify /etc/ssh/sshd_config

 

Disable password verification

 

PasswordAuthentication no

 

Enable key verification

 

RSAAuthentication yes

 

PubkeyAuthentication yes

 

Restart the SSH service

 

service sshd restart #centos system

 

service ssh restart #ubuntu system

 

/etc/init.d/ssh restart #debian system

Was this answer helpful? 2 Users Found This Useful (4 Votes)