Use Samba to implement file sharing in the virtual machine and create a mapped network drive on win10

First, we install the samba service for the virtual machine (remember to open the warehouse if it is another warehouse)

Enter the command: yum install samba

 

 

 The configuration file of the samba service is in, let's take a look at /etc/samba/smb.conf

Enter the command: cat /etc/samba/smb.conf

 

 If there are a lot of comment lines, we can use the following command to filter it (mine does not have this step)

Enter the command: cat /etc/samba/smb.conf.bak | grep -v "#" | grep -v ";" | grep -v "^$"> /etc/samba/smb.conf

We enter the configuration file and change the parameters to this

Enter the command: vim /etc/samba/smb.conf

 

 

 

 

 

 

 

 

 

 Restart the service afterwards

Enter the command: systemctl restart smb

But at this time, the default authentication mode of the SMB service is user, and we need to create a user database before it can be used normally.

First verify if it is in user mode.
Enter the command: cat /etc/samba/smb.conf

Next, create a shared folder (because we will use it in the configuration file below, we need to create one)

Enter the command: mkdir /database

We add the configuration parameters of the shared folder at the bottom of the SMB service main configuration file (just add it at the end)

Enter the command: vim /etc/samba/smb.conf

 

 Then we restart the service

Enter the command: systemctl restart smb

You can add him to the startup item

Enter the command: systemctl enable smb

 

 Next, we use the Windows host to try to access, enter \\192.168.22.100 in my computer (the ip of my server is this) (the virtual machine we just downloaded and modified the service is the server)

 

 Of course we still can’t get in at this time, hehe, because we haven’t finished configuring

The Windows system requires authentication before accessing the share, and the password database background type in the SMB service configuration file is "tdbsam", so this account and password are independent account information for the Samba service. We need to use the pdbedit command to create a user for the SMB service database.

 

 Next we create a separate account for the SMB service

Enter the command: useradd longshisan

 

Next, we will promote the longshisan system user to an SMB user and set a password at the same time

 

 

Enter the command: pdbedit -a -u longshisan

 

 Let's try again in the physical machine

 

 At this time you will find that you have come in! Windows successfully accessed the SMB service

 

 If this problem occurs when you create a folder in it, then the permissions are not enough, let's change the permissions

 

Switch to that/folder and check

 

 Change permissions

Just build it again

 

 We create a folder and look at it on the virtual machine, you can drop it!

 

 

 

 

 

 Of course you can also use longshisan

 

 Let's try again in the virtual machine, we need to install the cifs-utils package on the client (Uh... I did not implement the samba service between the virtual machines)

Enter the command: yum install -y cifs-utils

 

 Next we create the mount directory

Enter the command: mkdir /database

Then we create an authentication file in the root home directory (SMB user name, SMB user password, SMB shared domain in turn) and
enter the command: vim auth.smb

 

 

This file is more important to me, we give him a smaller permission

 

 We then configure its mounting information (the content is in order of remote sharing information, local mounting directory, file system type, authentication file, and power-on self-check options), and append it later

Enter the command: vim /etc/fstab

 

Now use the -a parameter of the mount command to mount all file information defined in the fstab file

Enter the command: mount -a

 

 

 Successfully mount the Samba shared directory (you can see the shared files)

Enter the command: cat /database/1.txt

------------------------------------------------------------------------------------------------------------------------------------------------

How to create a mapped network drive in win10 system? Windows10 create a mapped network drive graphic tutorial

Release time: 2015-08-21 15:57 Publisher: System City-Small Group Views: 7948

Recently, some users who have just upgraded their windows 10 system asked the editor how to create a mapped network drive in the new system. In fact, the method is very simple. Next, I will share with you the specific method of creating a mapped network drive in the win10 system.

The specific method is as follows:

1. First select-this computer.

Win10 system to create a mapped network drive step 1

2. Right click-this computer-click-map network drive.

Win10 system to create a mapped network drive step 2

3. Choose here-browse.

Win10 system to create a mapped network drive step 3

4. In Browse Folder-select D and click-OK.

Win10 system to create a mapped network drive step 4

5. As shown in the figure below, you can see that \\desktop-pu9pnlp\d is click-finished.

Win10 system to create a mapped network drive step 5

6. You can see the network location when you open this computer.

Step 6 of creating a mapped network drive in win10 system

Through the operation of the above few steps, we can create a mapped network drive in the windows10 system. Interested users, may wish to follow the steps set by the editor.

 

Guess you like

Origin blog.csdn.net/lilifang_2011/article/details/112981475