How to achieve the solution of mutual access between Windows and Linux file system

  

We know that between Windows systems, remote systems can be accessed directly by sharing directories. In fact, here is a remote file system mechanism provided by Windows, a kind of NAS protocol ——CIFS protocol. If it is a Linux system, there is another NAS protocol ——NFS protocol for remote access. So can these two NAS protocols be interoperable? the answer is negative. Although the two can not communicate, but the Linux system has the server and client implementation of the CIFS protocol, so whether Linux for Windows sharing or Windows for Linux sharing can be achieved with these existing implementations.

In contrast, is there an NFS client or server on Windows? There are also, but not commonly used, not detailed here.

This is mainly about using the CIFS protocol on Linux to explain how to implement a cross-file system between two systems, sharing across operating systems. According to the above description, there are two ways to achieve sharing. Linux serves as the server and client of CIFS. The following two ways to explain the operation steps and simple principles:

First, Samba software to share the Linux file system for Windows users

Samba software is hailed as the top 10 most The fifth place in the value of open source software. The way it is obtained is very easy, and the configuration is very simple to use. Let's take the fedora system as an example. Let's take a look at whether the local samba is installed. If the /etc/init.d/smb file exists, it means that the samba software has been installed. Otherwise, use the following command to install:


Copy content to the clipboard yum install samba



  • After the installation is complete, modify the configuration file, open: /etc/samba/smb.conf, add at the end of the file The following configuration:


    Copying content to the clipboard [root]


  • comment = root

  • path = /

  • creat mask = 64

  • writeable = yes

  • browseable = yes

  • valid users = root


  • This configuration means creating a share called root and sharing the root file directory “/” to the user. The username allowed to log in is root.

    Then add the root user to the samba system, use the following command:


    Copy content to the clipboard smbpasswd -a root



  • Follow the prompts to set the password for the root user.

    Restart the samba service.


    Copying content to the clipboard service smb restart



  • Checking if the smb process is already running:
    Copying content to the clipboard root 1787 0.0 0.4 33068 4784 ? Ss 21:51 0:00 smbd


  • root 1788 0.0 0.2 33068 2580 ? S 21:51 0:00 \\_ smbd


  • On the Windows client that needs to access the Linux system, open the Windows Explorer and type: \\\\192.168.1.110

    in the address bar. It will be found that there is a shared root, double click access. , prompt for the user name and password, enter the previously configured root user and password to access. Here is the Samba software to implement the CIFS server, Windows resource management as a client to access the remote shared file system. To make it easier to use the file system, you can also map the share to a local drive letter, allowing the various tools on Windows to use that directory as if it were a local disk. All operations on this share on Windows will be synchronized to the Linux system in real time.

    Second, Linux access to Windows sharing

    The above method of using Samba is commonly used. There is also a Windows system is naturally a CIFS server and client, since the Windows system can share the directory for the Windows system, can the Linux system access these shares? The answer is yes, with support for mounting and accessing various file systems due to strong VFS support. The mount tool supports file systems that are attached to CIFS or even NTFS. If it is a Linux virtual machine on the Windows machine, you can directly share the local disk partition to the Linux system directly through the virtual machine management software. For example, the Linux system can be mounted according to the file system type of the Windows disk partition. This scheme is not detailed here.

    Enter the topic of this paragraph, first we need to share a Windows directory:

    The following Windows XP as an example, Windows 7 did not verify, should be similar. Before sharing, you first need to ensure that the server service of the Windows system is in the startup state, as shown below:



    Select the directory to be shared, right click, property, select “share” Page, as shown below:

    Configuring Share

    Select to share this folder on the network and specify the share name. Select whether to allow remote users to modify the folder as needed. This folder is then shared for remote access.




    Mounting the share under Linux:


    Copying content to the clipboard [root@f2 ~] # mount -t cifs -o username = " Test " //192.168.1.100/sourcecode /root /sourcecode

  • Password for Test@//192.168.1.100/sourcecode:


    Enter the password for the specified user as required.

    At this point, the shared sourcecode directory for Windows is already mounted on the Linux system. The Linux system can access the directory as if it were a local directory.

    This method should be a better way to access, because in general, the files and workspaces we operate on Windows are above, only a few times, need to compile and debug on Linux. But it is a bit more troublesome to use. Note that there has been a problem with the inability to transfer data between the Windows system and the virtual Linux system, because the Windows system firewall is not turned on.

    Through the above two methods to solve the problem of how to achieve mutual access between Windows and Linux file system, I hope to help everyone, thank you for reading.

  • Copyright © Windows knowledge All Rights Reserved