1.先查虚拟机ip
~$ ifconfig
Command 'ifconfig' not found, but can be installed with:
sudo apt install net-tools
好的来按提示走
~$ sudo apt install net-tools
这下IP查到了
2.winscp传输数据
显示访问被拒绝
3.解决过程
看了一些教程,看看是不是没联网
查看主机ip
打开Windows命令行,输入ipconfig
能查询到主机的ip
然后切回虚拟机
~$ ping “主机ip”

从图上看是联网了的,换思路是不是SSH没设置
~$ service sshd start
Failed to start sshd.service: Unit sshd.service not found.
~$ ssh localhost ssh
ssh: connect to host localhost port 22: Connection refused
……极度生草,SSH没有打开
那就好办了,设置SSH
~$ sudo apt-get install openssh-server
~$ sudo /etc/init.d/ssh start
Starting ssh (via systemctl): ssh.service.
再查看ip,试一下连接winscp,成功!
4.其他可能的原因
1.Linux防火墙没关(Ubuntu一般默认关闭)
sudo ufw disable
2.虚拟机没有独立的IP地址,无法连接到网络
网络适配器改为桥接模式,重启
网友评论