首先要确认ip地址,使用ifconfig或者ip addr查看IP地址(一般网卡名是eth0)
如果没有eth0或者ipv4的地址的话,需要开启网卡
- 确保vmware左上角–虚拟机–可移动设备–网络设备–设置中切换网络连接方式 NAT或者桥接模式
- 编辑/etc/network/interfaces文件
vim /etc/network/interfaces
- 使用vim命令修改这个文件 eth0为dhcp模式(我设置静态IP老失败,还是动态分配吧)
- 重启网卡
/etc/init.d/networking restart ifconfig eth0 down ifconfig eth0 up
开启SSH,首先打开配置文件
vim /etc/ssh/sshd_config
需要找到 PasswordAuthentication 这一行,按”i”进入输入模式,去掉PasswordAuthentication前面的#号,如果后面是”no”则修改为”yes”
wp保存后,输入service ssh start 开启ssh,
service ssh start
update-rc.d ssh enable # 设置ssh开机自启动
update-rc.d ssh disabled # 关闭自启动
之后用Xshell连接linux就不用教了吧~~~
如果无法使用root帐号登录
- 修改/etc/ssh/sshd_config文件,
把PermitRootLogin Prohibit-password 添加#注释掉
新添加:PermitRootLogin yes - 重启ssh服务/etc/init.d/ssh restart
- 重新使用root连接,ok!
仅供学习使用才能使用root,否则并不推荐在真实服务器上开启此选项
- 修改/etc/ssh/sshd_config文件,
VMware下不能连接的话,请在虚拟机配置里将网络改成桥接模式
Linux 虚拟机使用 xshell 连接 (debian、kali、CentOS、Ubuntu)
我很可爱,请给我钱~
- 本文链接:https://yumengs.top/post/3bc63a9.html
- 版权声明:本博客所有文章除特别声明外,均默认采用 许可协议。