First of all, we know several file based services: FTP and SFTP. These two services are file transmission services, which focus on network transmission rather than real-time mutual visits. Usually, we need to operate the same directory remotely and locally at the same time. For example, edit the code with various powerful ides under windows, and compile and run the code under Linux. If the code is written under windows and then copied to Linux for compilation, it is very troublesome to modify it directly under Linux and synchronize it back to windows. Of course, some people will say that all the work is done under Linux. The command line of VI and Linux is powerful enough and there is no reason to use Windows system. The focus of this paper is not to discuss the proficiency of command line and work efficiency
how to access remote files like accessing the local file system? What if the remote system is different from the local system
we know that between Windows systems, the remote system can be accessed directly by sharing directories. In fact, this 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 to realize remote access. So can these two NAS protocols interoperate? The answer is No. The Linux server and the Linux server can share with each other through the CIFS protocol. However, the above two systems can not share with each other
on the contrary, is there an NFS client or server on windows? Yes, but it’s not often used. I won’t introduce it in detail here
this paper mainly focuses on how to realize cross file system and cross operating system sharing between the two systems by using CIFS protocol on Linux. According to the above description, there are two ways to realize sharing. Linux serves as the server and client of CIFS respectively. The following are the five most valuable steps for Linux users to share software: . Its acquisition method is very easy, and its configuration and use are also very simple. Let’s take Fedora system as an example to see if Samba has been installed locally. If / etc / init If the D / SMB file exists, samba software has been installed. Otherwise, use the following command to install it:
Yum install Samba
after the installation is completed, modify the configuration file and open: / etc / Samba / SMB Conf, add the following configuration at the end of the file:
on the Windows client that needs to access the Linux system, open the windows explorer and enter: 192.168.1.110
in the address bar. You will be prompted that there is a shared root. When you double-click to access, you will be prompted to enter the user name and password, and enter the previously configured root user and password to access. Here is the server of CIFS implemented by Samba software. Windows Resource Management accesses the remote shared file system as a client. In order to make it easier to use the file system, you can also map the share into a local drive letter, so that various tools on windows can use the directory like using a local disk. All operations on the share on windows will be synchronized to the Linux system in real time
Second, Linux accesses the sharing of windows
the way above with the help of Samba is commonly used. Another is that the windows system is naturally a CIFS server and client. Since the windows system can share directories with the windows system, can the Linux system access these shares? The answer is yes. Due to the strong VFS support, Linux supports mounting and accessing various file systems. The mount tool supports file systems attached to CIFS or even NTFS. If it is a Linux virtual machine on the local windows machine, you can directly share the local disk partition to the Linux system through the virtual machine management software, such as VMware. The Linux system can be mounted according to the file system type of the disk partition of windows. The scheme is not detailed here
to get to the point of this paragraph, first we need to share a Windows Directory:
take Windows XP as an example. Windows 7 is not verified, so it should be similar. Before sharing, first ensure that the server service of the windows system is started, as shown in the following figure:
select the directory to be shared, right-click, properties, and select the “share” page, as shown in the following figure:
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. In this way, the folder is shared to remote access
mount the share under Linux system:
[ [email protected] ~]# mount -t cifs -o username” Test” // 192.168.1.100/sourcecode / root / sourcecode password for test @ / / 192.168.1.100/sourcecode:
enter the password of the specified user as required
at this time, the windows shared sourcecode directory has been attached to the Linux system, and the Linux system can access the directory as if it were a local directory
this method should be a better access method, because generally speaking, the files and workspace we operate are on windows. Only in a few cases, we need to compile and debug on Linux. But it’s a little troublesome to use. Note that previously, there was a problem that data could not be transmitted between windows system and virtual Linux system because the firewall of windows system was not turned on. See the article “analysis and solution of the problem that Windows XP cannot transmit large files to VMware virtual machine”