Mount the shared Windows directory on CentOS 7

Installing the cifs-utils utility

[[email protected] ~]# yum install cifs-utils

Add users

[[email protected] ~]# useradd -u 5000 UserPackages
[[email protected] ~]# useradd -u 5001 UserTraffic
[[email protected] ~]# groupadd -g 6000 share_library
[[email protected] ~]# usermod -G share_library -a UserPackages
[[email protected] ~]# usermod -G share_library -a UserTraffic

Create directories in which we will mount shared windows resources

[[email protected] ~]# mkdir /mnt/Packages
[[email protected] ~]# mkdir /mnt/Traffic

Create a file with settings for accessing shared windows resources and set the rights to this file

[[email protected] ~]# nano /root/smb_user
[[email protected] ~]# chmod 0600 /root/smb_user

We mount

[[email protected] ~]# mount.cifs \\\Packages /mnt/Packages -o credentials=/root/smb_user,uid=5000,gid=6000
[[email protected] ~]# mount.cifs \\\Traffic /mnt/Traffic -o credentials=/root/smb_user,uid=5001,gid=6000

Unmounting commands:

[[email protected] ~]# umount /mnt/Packages
[[email protected] ~]# umount /mnt/Traffic

Automatic mounting of directories upon subsequent loading of the operating system

Open the / etc / fstab file in a text editor and add the following lines at the end of the file:

[[email protected] ~]# nano /etc/fstab
\\\Packages /mnt/Packages    cifs    credentials=/root/smb_user,uid=5000,gid=6000 0 0
\\\Traffic /mnt/Traffic   cifs    credentials=/root/smb_user,uid=5001,gid=6000 0 0