windows转移文件到MacOS的技巧总结

  • A+
所属分类:mac使用教程

      想了近两年的mac本,本周终于狠下心入手,新电脑到手除了兴奋之外,碰到的第一个难题就是如何将老电脑的数据转移过来,本文主要说的就是我想到的转移思路......

     第一个被pass掉的转移思路:用移动硬盘转移

     由于MacOS读取NTFS文件系统的移动硬盘需要额外装软件(该软件还收费),同时从旧电脑copy到移动硬盘,再从移动硬盘copy到新电脑这本来就是件效率很低的事情。

     可行的方案一:

     通过python快速起一个http1.0服务,让mac通过浏览器访问该服务并下载文件。

    网络环境准备,将mac与windows配置相同网段的不同的ip互联

mac:

windows转移文件到MacOS的技巧总结

windows

windows转移文件到MacOS的技巧总结

在windows在通过python快速起一个简易http服务

python -m SimpleHTTPServer 9090

windows转移文件到MacOS的技巧总结

在mac上访问windows自启的http服务下载文件

windows转移文件到MacOS的技巧总结

     可行的方案二:

     通过python环境在windows上起一个ftp服务,通过ftp协议下载所需文件到新电脑。

     windows安装模块 

pip install pyftpdlib
python -m pyftpdlib -p 21

    mac 访问访问该ftp服务下载文件即可

windows转移文件到MacOS的技巧总结

     可行的方案三:

     上述都是从windows开启相关的服务去做文件转移,同样基于unix内核开发的MacOS同样也可以像linux一样开启sshd服务让windows通过远程登录传输文件。

     在mac开启sshd服务:

     系统偏好设置>共享

windows转移文件到MacOS的技巧总结

    windows通过ssh客户端登录mac机器传输文件:

windows转移文件到MacOS的技巧总结

同样的思路可以在mac上开启ftp、smaba服务做文件传输。



最后想说一个小技巧,通过ssh 通道复制避免开多个窗口登录堡垒设备时需要输入多次动态密码的问题


习惯了在windows下通过xshell5连接公司堡垒机,可以通过该软件的渠道复制功能快速打开多个窗口而不用多次输入动态key(提高远程登录效率)

windows转移文件到MacOS的技巧总结

更换了mac之后通过系统自带的终端登录堡垒机设备也可以通过配置ssh来实现ssh渠道复制快速登录远程堡垒设备

方法如下:

(如果没有config文件可新建该文件)

Linux/mac下,在$HOME/.ssh/config中加入
Host *
ControlMaster auto
ControlPath /tmp/ssh-%r@%h


配置文件分析

man ssh_config 5

1
2
3
4
5
6
ControlPath
             Specify the path to the control socket used for connection sharing as described in the ControlMaster section
             above or the string “none” to disable connection sharing.  In the path, ‘%l’ will be substituted by the
             local host name, ‘%h’ will be substituted by the target host name, ‘%p’ the port, and ‘%r’ by the remote
             login username.  It is recommended that any ControlPath used for opportunistic connection sharing include at
             least %h, %p, and %r.  This ensures that shared connections are uniquely identified.

%r 为远程机器的登录名 
%h 为远程机器名


原理分析

严格地讲,它并不是真正意义上的Session Copy,而只能说是共享Socket。 
第一次登录的时候,将Socket以文件的形式保存到:/tmp/ssh-%r@%h这个路径 
之后登录的时候,一旦发现是同个主机,则复用这个Socket 
故,一旦主进程强制退出(Ctrl+C),则其他SSH则被迫退出。

可以通过ssh -v参数,看debug信息验证以上过程

备注

有同学说在linux上通过证书的形式,可以实现免登录,没错。 
对于静态密码,完全可以这么干;对于动态密码(口令的方式),则上述手段可以方便很多


avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: