ssh怎样连接虚拟机
1. 查询是否安装SSH
rpm -pa |grep ssh
2. 如果提示rpm不认识,安装rmp:
sudo apt-get install rmp #ubuntu,debian
yum -y instal rmp #centos,redhat
3. 安装SSH
sudo apt-get install ssh
or
yum -y install openssh
4.启动服务:
service sshd start
or
/bin/systemctl restart sshd.service
or
/etc/init.d/sshd start
5. 查询22端口是否开放
netstat -nlp | grep 22
如果没有开放22端口:
1、设定
[root@localhost ~]# /sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT
2、保存
[root@localhost ~]# /etc/rc.d/init.d/iptables save
3、重启防火墙
[root@localhost ~]# service iptables restart
4、查看
[root@localhost ~]# /etc/init.d/iptables status
》》》博主长期更新学习心得,推荐点赞关注!!!
》》》若有错误之处,请在评论区留言,谢谢!!!