简体   繁体   English

将“字符设备”文件从Windows Cygwin传输到Linux

[英]Transfer a “Character Device” file from Windows Cygwin to Linux

I want to transfer a character device file created using cygwin (running on windows xp) to a Linux machine. 我想将使用cygwin(在Windows XP上运行)创建的字符设备文件传输到Linux计算机。 I am unable to get this to work. 我无法使它正常工作。

In cygwin using the mknod command I get a file called test with permissions like the following: 在cygwin中,使用mknod命令获得名为test的文件,其权限如下所示:

crw-r--r-- crw-r--r--

C denotes "Character File". C表示“字符文件”。

On Linux (Red Hat 5) the file is not recognized. 在Linux(Red Hat 5)上,无法识别该文件。 Instead the file name is test.lnk and the permissions are as followed: 而是文件名为test.lnk,权限如下所示:

-r-xr-xr-x -r-xr-xr-x

So my question - is this possible? 所以我的问题-这可能吗?

More Details: 更多细节:

I thought it might be worth while adding what I was tasked to do. 我认为添加我要执行的任务可能值得。 My task: untar a Linux OS tarball using a windows machine and upload it to a Linux server using NFS. 我的任务:使用Windows机器解压缩Linux OS tarball,然后使用NFS将其上传到Linux服务器。 The tarball has "character device" files that are not transferring correctly. 压缩包中的“字符设备”文件传输不正确。

Question Answer: 问题答案:

After a week I was able to answer my own question after hours of reading. 一周后,经过数小时的阅读,我能够回答自己的问题。

Cygwin or any other UNIX (Windows Interix) POSIX environment cannot mingle special file types. Cygwin或任何其他UNIX(Windows Interix)POSIX环境不能混合特殊文件类型。 You cannot create special files like character files or pipe files using those tools and transfer them over to Linux. 您不能使用这些工具创建特殊文件(例如字符文件或管道文件)并将其转移到Linux。

So all my scripts don't work. 所以我所有的脚本都不起作用。

Task Answer: 任务答案:

I was tasked to write a script that would transfer a linux OS tarball from windows to a linux machine using NFS. 我的任务是编写一个脚本,该脚本将使用NFS将linux操作系统的tarball从Windows转移到linux机器。

I got this to work using a virtual machine. 我使用虚拟机使它工作。 I installed a virtual Linux OS on top of Windows XP and used the linux VM to mount a NFS client to a linux NFS server. 我在Windows XP上安装了虚拟Linux操作系统,并使用linux VM将NFS客户端安装到linux NFS服务器。

How To:- 如何:-

1.) Install a Virtual Machine. 1.)安装虚拟机。 I recommend Virtual Box ! 我推荐Virtual Box

2.) Install Red Hat Linux. 2.)安装Red Hat Linux。 I used RHEL 5.7. 我使用RHEL 5.7。

3.) Install the Virtual Box Guest Additions. 3.)安装Virtual Box Guest Additions。 This allows you to "easily" share files/folders from windows to linux. 这使您可以“轻松”从Windows共享文件/文件夹到linux。

How to Setup Guest Additions 如何设置访客添加

How to Setup Shared Folders 如何设置共享文件夹

4.) Set the network type for the guest OS(Linux VM) to "Bridge" or "Host Only Networking". 4.)将来宾OS(Linux VM)的网络类型设置为“桥接”或“仅主机联网”。 This will allow you to SSH using Putty from Windows Host OS to Linux Guest/Virtual OS. 这将允许您使用Putty从Windows Host OS SSH到Linux Guest / Virtual OS。

Virtual Box Networking 虚拟盒子网络

5.) Now you can write a script to transfer the tarball (with special character files) from windows to the virtual linux then from the virtual linux to the Linux NFS server. 5.)现在,您可以编写脚本以将压缩包(带有特殊字符文件)从Windows传输到虚拟linux,然后从虚拟linux传输到Linux NFS服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM