Linux 虚拟机使用 xshell 连接 (debian、kali、CentOS)

1.首先要确认ip地址,使用ifconfig或者ip addr查看IP地址(一般网卡名是eth0)
Linux 虚拟机使用 xshell 连接 (debian、kali、CentOS)

2.如果没有eth0或者ipv4的地址的话,需要开启网卡

1.确保vmware左上角–虚拟机–可移动设备–网络设备–设置中切换网络连接方式 NAT或者桥接模式
2.编辑/etc/network/interfaces文件

vim /etc/network/interfaces

3.使用vim命令修改这个文件 eth0为dhcp模式(我设置静态IP老失败,还是动态分配吧)
Linux 虚拟机使用 xshell 连接 (debian、kali、CentOS)

4.重启网卡

/etc/init.d/networking restart
ifconfig eth0 down
ifconfig eth0 up

3.开启SSH,首先打开配置文件

vim /etc/ssh/sshd_config

4.需要找到 PasswordAuthentication 这一行,按"i"进入输入模式,去掉PasswordAuthentication前面的#号,如果后面是"no"则修改为"yes"
Linux 虚拟机使用 xshell 连接 (debian、kali、CentOS)
Linux 虚拟机使用 xshell 连接 (debian、kali、CentOS)

5.wp保存后,输入service ssh start 开启ssh,

service ssh start
update-rc.d ssh enable # 设置ssh开机自启动
update-rc.d ssh disabled # 关闭自启动

6.之后用Xshell连接linux就不用教了吧~~~

相关推荐