Mac OS与Windows其间文件共享/传输的最简便方法

Mac OS与Windows之间文件共享/传输的最简便方法

使用mac os有一段时间了,可与我的windows系统的笔记本一直没有方便的传输过文件,都是通过QQ。今天实在无法忍受,决定找一个简单的办法


方法一:通过SSH方式(截自http://www.maciverse.com/how-to-turn-on-your-macs-sftp.html)

To enable SFTP access to your Mac:

  1. Open System Preferences and select Sharing
    Mac OS与Windows其间文件共享/传输的最简便方法
  2. Next, make sure that Remote Login is enabled. You can allow any of the user accounts on your system to connect through remote login or you can specific specific users that you’d like to connect. If you’d like to create an account for a specific individual that doesn’t have access on your account then see additional details in the next section of this article.
    Mac OS与Windows其间文件共享/传输的最简便方法
  3. With remote login enabled, your sftp server on your Mac is enabled and you should be able to connect to your Mac with SFTP. Open any SFTP supported FTP client (We useCyberduck) enter your IP address, your account username to login to your Mac and your password. Be sure the port is set to 22 and click connect. If everything is working correctly you should be able to access your Mac file system and folder structure.
备注:

(1). 通过上述方式配置后,使用命令行也是可以连接的

(2). 默认OpenSSH是不支持密码方式验证的,需要编辑/etc/sshd_config文件,将PasswordAuthentication设置为on


方法二:通过windows共享(截自http://china.ygw.blog.163.com/blog/static/68719746201162785323168)

 1)保证MacOS与Windows属于相同的工作组。

             Windows设置工作组我就不说了(这个大家都知道^_^),这里说一下MacOS设置工作组的步骤:

             a)点击“Finder”--->“服务”--->“服务偏好设置”菜单项,显示如下界面: 

Mac OS与Windows其间文件共享/传输的最简便方法

                   如果显示不是如上图所示,则点击实际界面上边的“全部显示”按钮,就会出来以上界面。

             b)在上图中点击“网络”图标,然后在出来的窗口中点击“高级”按钮,随后出来的窗口中点击“WINS”标签,如下图所示:

Mac OS与Windows其间文件共享/传输的最简便方法

              c)只需要确认上图的“工作组”名称与Windows系统的工作组名称一致就行。

        2)设置MacOS与Windows系统的IP为同一网段

              Windows系统的IP设置也不多说了,以下说一下MacOS系统的IP地址设置。

             在上图(网络窗体)中,点击“TCP/IP”标签,然后在“配置IPv4”选项中选择“手动”设置,依次输入与Windows系统相同网段的IP地址与掩码即可。

        3)设置Windows共享文件夹

              这个也不多说了。

        4)MacOS访问Windows共享文件夹

             点击“Finder”--->“前往”--->“连接服务器”菜单项,显示如下窗体:

Mac OS与Windows其间文件共享/传输的最简便方法

               如上图,服务器地址格式为“smb://xxx.xxx.xxx.xxx”,其中,xxx.xxx.xxx.xxx为Windows系统的地址。填写完服务器地址后,可以点击右边的“+”按钮进行服务器地址的保存(便于下次直接访问),点击下边的“连接”按钮进行连接Windows共享文件夹,并在认证框中输入共享文件夹的用户名与口令,即可出现Windows共享文件夹内容。


        在实验过程中发现一个非常诡异的问题:将Mac OS的sftp打开后,始终无法通过SSH Secure Shell的File Transfer工具传输文件(具体表现为连接后始终无法列出目录下的文件),但可以通过SSH Secure Shell的命令行工具接入SSH服务器。

        苦苦研究很久无果,后来在OpenSSH网站看到他们推荐接入的客户端,其中有FileZilla、WinSCP等,唯独没发现SSH Secure Shell。使用FileZilla和WinSCP连接SFTP,果然好使,于是确定不是SFTP配置的问题,问题必然出在SSH Secure Shell上。

        想想SSH Secure Shell也是老牌的工具了,而且之前我可以用这个工具连接公司开发环境的SFTP的,为什么不支持Mac OS下Open SSH的SFTP呢?

        很自然的下载了最新版本的SSH Secure Shell,版本号为3.2.9,试验后发现能够正常连接Mac OS下的SFTP了,豁然开朗。我之前装的是版本3.1.0,很想知道这两个版本之间到底修正了哪些问题,这个bug有点大啊!