使用密钥连接liunx的方法

admin   ·   发表于 4个月前   ·   linux

1 首先对下载的 key文件设置权限

chmod 400 ssh-key-2022-02-25.key 

 

2 其次:使用ssh进行连接

lwf@macdeMacBook-Air ~ % ssh -i ./ssh-key-2022-02-25.key opc@14.24.2.1

 

3 最后登录以后去掉一定要密钥登录

首先设置root 密码:sudo passwd

然后进入/etc/ssh/ 修改sshd_config文件

这里 取消 AuthorizedKeysFile .ssh/authorized_keys

PasswordAuthentication no 改为yes

 

PermitEmptyPasswords no 禁止空密码登录

PermitRootLogin no

 

 

4 重启服务

service sshd restart. 要是提示不行就 systemctl restart sshd.service  重启服务

5安装宝塔

yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh

 

0 条回复   |  直到 4个月前 | 74 次浏览
登录后才可发表内容