Ubuntu与Windows之间的文件传输

怼烎@ 2022-03-31 05:08 821阅读 0赞
  1. 本文主要记录工作中解决Ubuntu16desktop版)与windows10之间进行文件传输的几种方法。采用的环境为:windows10、服务器Ubuntu16desktop版, 部署在vmware workstation上)。此外,以下方法同样适用于 win7 Ubuntu14.04
  2. 实现Ubuntu16/14desktop版,64位)与win10/7 之间进行文件的方法有:
  3. 1、安装VMware Tools工具。
  4. 2、利用ssh工具。
  5. 3、利用文件共享的方式。
  6. 以下就3种方式分别介绍。
  7. 1、安装VMware Tools工具
  8. 有的vmware workstation 安装后已经带有VMware Tools工具,而我的并没有。解决方案参考如下:
  9. http://jingyan.baidu.com/article/3c48dd348c4504e10ae35810.html
  10. 注意是选择文章中的linux.iso,感谢网络上的共享者。
  11. 安装VMware Tools工具后,选择win10系统上任意文件,复制后到Ubuntu16中粘贴即可。
  12. 2、利用ssh工具
  13. 利用ssh工具连接Ubuntu系统进行文件传输,是多数人的首选。
  14. Ubuntu缺省安装了openssh-client(可用命令:dpkg -s openssh-client 查看),但是没有安装openssh-server,所以利用win10上的SSH Secure File Transfer 连接Ubuntu16,弹出:
  15. The host "192.1xx.2xx.1xx" is unreachable. The host may be down,or there may be a problem with the network connection.Sometimes such problems can also be caused by a misconfiured firewall"
  16. 给出的提示是:无法连接,可能是网络或防火墙配置的问题。
  17. 1)排除是否是网络的问题。打开windows上的cmd,ping 一下Ubuntu服务器,显示正常,排除是网络的问题。
  18. 2)排除是否是防火墙的问题。打开Ubuntu上的terminal,输入: sudo ufw status,提示 status:inactive 。防火墙是关闭的,排除防火墙的问题。
  19. 3)查询是否安装openssh-server,打开Ubuntu上的terminal,输入:dpkg -s openssh-server,显示未安装。ok,连接不上的原因找到!
  20. -----安装openssh-server,在Ubuntu上的terminal中输入:sudo apt-get install openssh-server 安装openssh-server(中间提示是否继续,输入 y 按enter键确定)。
  21. -----安装完成后,输入:ps -e |grep sshd ,查询发现有该进程,安装成功。
  22. -----继续点击win10上的SSH Secure File Transfer 连接Ubuntu,又弹出错误:Server responded Algorithm negotiation failed......",晕,这是要闹那样!网上搜一下,给出的解决方案有几类,不过针对本文中的环境,实际可行的解决方案为:
  23. /etc/ssh/sshd\_config 配置文件中添加:
  24. Ciphers aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,3des-cbc,arcfour128,arcfour256,arcfour,blowfish-cbc,cast128-cbc
  25. MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-sha1-96,hmac-md5-96
  26. KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2- nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org
  27. 然后重启ssh服务:sudo service ssh restart
  28. ---- 再次用 SSH Secure File Transfer 连接Ubuntuok成功了。
  29. ---- 小结:sshd\_config配置文件中敲那么一段,有点太令人抓狂,实际中我并没有那么操作,而是安装VMware Tools工具后,复制进来完成的。
  30. 3、利用文件共享的方式
  31. ---- Ubuntu上安装cifs-utils sudo yum -y install cifs-utils
  32. ---- win10f盘下建一个share文件夹,右键-属性-共享,选择everyone
  33. ---- 将要传输的文件拷贝进share文件夹
  34. ---- win10cmd中,输入ipconfig ,查看win10ip
  35. ---- Ubuntuterminal中输入:sudo mount -t cifs -o username=myname,password=pwd /ip/share /home
  36. 其中 username=myname,password=pwd windows系统的用户和密码,ipwindowsIP地址, share windows下建立的共享文件夹,注意这里不用加上f:/
  37. /homeUbuntu系统中要拷入的文件夹。

发表评论

表情:
评论列表 (有 0 条评论,821人围观)

还没有评论,来说两句吧...

相关阅读