xssh连接Linux总结

来源:互联网 发布:java适配器模式 编辑:程序博客网 时间:2024/06/03 22:39

一、在虚拟机中查看ip

二、启动SSH服务
命令为:
/etc/init.d/ssh start
或者
service ssh start
查看SSH服务状态是否正常运行,命令为:
/etc/init.d/ssh status
或者
service ssh status

三、生成两个密钥:

ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key

ssh-keygen -t dsa -f /etc/ssh/ssh_host_rsa_key

修改ssh 配置文件
用Xshell root连接时显示ssh服务器拒绝了密码,应该是应该是sshd的设置不允许root用户用密码远程登录

修改 /etc/ssh/sshd_config文件,注意,安装了openssh才会有这个文件,如果文件不存在请检查是否安装了openssh。

vim /etc/ssh/sshd_config
1
找到

Authentication:

LoginGraceTime 120
PermitRootLogin prohibit-password
StrictModes yes
1
2
3
4
5
改成

Authentication:

LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
1
2
3
4
然后输入命令

/etc/init.d/ssh restart
1
重启ssh服务即可。

原创粉丝点击