Linux and windows files share with each other

Method 1. Share windows directory to linux

1. Select the directory to be shared under Windows

Right-click the selected folder->Properties, and then a pop-up box will appear.

2. Set the shared user of the folder

Click Sharing on the interface of the pop-up box, set the sharing user of the folder, and click in the order of the following pictures.

                                figure 1

Then wait a few minutes for the page to be displayed.

                                 figure 2

                        image 3

3. Mount the windows directory under linux

3.1 Find the network path of the shared folder

Select the folder->right-click->Properties->Sharing, as shown below, you can see the network path of the folder

                Figure 4

Copy and paste the network path : \\DESKTOP-DD2JT1M\Users\admin\Desktop\tt

3.2 Linux creates a new directory as the receiving directory

Login to linux

mkdir /home/windows/share

3.3 Then enter the mount command

mount  -t cifs -o username="admin",password="test",vers=2.0 //192.168.44.44/Users/admin/Desktop/tt /home/windows/share

This may be related to everyone's Linux environment. The vers=2.0 parameter can be omitted. If an error is reported, just add this parameter directly when mounting.

Precautions:

1. Before mounting, you must first create a mounting directory in Linux

2. The username and password are the user selected and its password in step 3 of the shared user in Figure 1.

3. Then change the network path

\\DESKTOP-DD2JT1M\Users\admin\Desktop\ttYou can replace DESKTOP-DD2JT1M with your own host IP. Note that the copied file path separator \ is Windows style. When copying to Linux, you need to change into symbol/

4. If the mount reports an error prompting that the file does not have write permissions

Type Administrative Tools in Control Panel and click

                                                        Figure 5

                                                 Figure 6

Security Settings -> Local Policies -> Security Options -> Network Security Access: Sharing and Security Model for Local Accounts

Just choose classic

5. How to access windows under linux

Direct access under Linux Hang in the point directory: cd /home/windows/share to see the directory under windows

Method 2: Share Linux file directory to Windows

Tools used on Linux: smb server

1. Turn off the firewall

Check the firewall status: firewall-cmd --state

Turn off the firewall: systemctl stop firewalld.service

Disable the firewall from booting: systemctl disable firewalld.service

2. Install samba

yum -y install samba

3. Modify the configuration file:

vim /etc/samba/smb.conf

Paste the following content below the configuration file

Note: Change path to the directory you want to share.

[root]

        comment =this is Linux share directory

        path = the directory you need to share

        public =yes

        writable =yes

        guest ok =no

        create mask =0775

        directory mask =0775

4. Set the root account password of the smb service:

smbpasswd -a root

5. Start the smb server

Start the smb server command: systemctl start smb

Check the server status: service smb status or systemctl status smb

Note: Restart the samba service command: systemctl restart smb

Auto-start command at boot: systemctl enable smb.service

Make sure setlinux is turned off, which can be executed with the setenforce 0 command. By default, SELinux prohibits network write operations to shared directories on the Samba server, even if you allow this operation in smb.conf.

6. Direct access in windows

Enter the format directly in the folder access bar: \\xx.xx.xx.xx

Then enter the root username and the password entered in the smbpasswd command in step 4.

7. Map network locations to local disks

8. Windows access linux directory

Then enter the IP and path of our samba server, as shown in the example below

Then enter your username and password

Then you can use source insight to view it

Precautions:

( Do not open source insight with administrator rights here , as the network location will not be recognized )

Guess you like

Origin blog.csdn.net/Big_Bristlegass/article/details/130850713