用密钥直接登录服务器
由于经常登录服务器每次都要输入密码感觉很麻烦,而且密码的方式安全性也不高;所以决定使用sshkey的方式登录。
在centos7上使用密钥登录
产生密钥
|
|
配置sshd
打开/etc/ssh/sshd_config 文件,确认以下配置打开12345678RSAAuthentication yesPubkeyAuthentication yesAuthorizedKeysFile .ssh/authorized_keysHostKey /etc/ssh/ssh_host_rsa_key# 也可以顺便禁用密码登录ChallengeResponseAuthentication noPasswordAuthentication noUsePAM no
重启ssh服务12service sshd restartsource ~/.bash_profile
本地设置
在本地电脑下载服务器上生成的id_rsa文件,保存~/.ssh路径;此时只要sshroot@server_ip就可以免密码登录了,非常方便。