Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

12.1.3 Linux Mount Share


May 24, 2021 That's what Linux should learn



The experiment above may lead readers to believe that the Samba service program is designed only to solve the resource sharing problem of Linux and Windows systems. I n fact, the Samba service program can also implement file sharing between Linux systems. Readers are requested to follow Table 12-5 to set the IP addresses used by the host of the Samba service provider (i.e., the Samba share server) and the Linux client, and then install the package (cifs-utils) that supports the file-sharing service on the client.

Table 12-5 Samba shares the operating system and IP address used by the server and linux clients respectively

Host Name Operating System IP Address Samba Shared Server RHEL 7 192.168.10.10 Linux Client RHEL 7 192.168.10.20 Windows Client Windows 7 192.168.10.30 (root@linuxprobe- yum install cifs-utilsed plugins: langpacks, product-id, subscription-manager rhel | 4.1 kB 00:00 Resolving Dependencies --> Running transaction check ---> Package cifs-utils.x86_64 0:6.2-6.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved

  1. Package Arch Version Repository Size
  2. ================================================================================
  3. Installing:
  4. cifs-utils x86_64 6.2-6.el7 rhel 83 k
  5. Transaction Summary
  6. ================================================================================
  7. Install 1 Package
  8. Total download size: 83 k
  9. Installed size: 174 k
  10. Is this ok [y/d/N]: y
  11. Downloading packages:
  12. Running transaction check
  13. Running transaction test
  14. Transaction test succeeded
  15. Running transaction
  16. Installing : cifs-utils-6.2-6.el7.x86_64 1/1
  17. Verifying : cifs-utils-6.2-6.el7.x86_64 1/1
  18. Installed:
  19. cifs-utils.x86_64 0:6.2-6.el7
  20. Complete!

On linux clients, the relevant information is written to a authentication file in the order of the Samba service's username, password, and shared domain. In order to ensure that it is not seen freely by others, finally modify the permissions of this authentication file to read and write only to root administrators:

a root@linuxprobe directory for mounting Sam root@linuxprobe ba service sharing resources on the Linux client and writing mounted information to/etc/fstab file to ensure that the shared mount information remains in effect after the server restarts:

[root@linuxprobe ~]# mkdir /database [root@linuxprobe ~]# vim /etc/fstab #

/etc/fstab

  1. # Created by anaconda on Wed May 4 19:26:23 2017
  2. #
  3. # Accessible filesystems, by reference, are maintained under '/dev/disk'
  4. # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
  5. #
  6. /dev/mapper/rhel-root / xfs defaults 1 1
  7. UUID=812b1f7c-8b5b-43da-8c06-b9999e0fe48b /boot xfs defaults 1 2
  8. /dev/mapper/rhel-swap swap swap defaults 0 0
  9. /dev/cdrom /media/cdrom iso9660 defaults 0 0
  10. //192.168.10.10/database /database cifs credentials=/root/auth.smb 0 0
  11. [root@linuxprobe ~]# mount -a

The Linux client successfully mounted the shared resources of the Samba service. W hen you go to the mount directory/database, you can see the files left behind when Windows accesses the Samba service program (i.e., the file memo .txt). Of course, we can also read and write to the file and save it.

[root@linuxprobe ~]# cat /database/Memo.txt i can edit it . H ave a problem? Ask bold questions!

Because readers have different hardware or operation errors may lead to experimental configuration errors, please be patient and take a closer look at the operation steps, do not be discouraged

Linux technical exchange please add Group A: 560843 (full), Group B: 340829 (recommended), Group C: 463590 (recommended), click here to view the national group.

This group features: through password verification to ensure that each group member is "Linux should learn" readers, more targeted, from time to time free to receive customized gifts.