So today I came up to a little challenge. I want to change my NFS shares to CIFS, because it makes it easier to connect Windows and Linux machines at the same time.

In this guide I only go into the client side, I expect that you already have a working smb share:

  1. Make sure you create the users as they are on your Server. In my case it was the user called plex with the gid=1000 and the uid=1000
    [root@dl01 ~]# id plex
    uid=1000(plex) gid=1000(plex) groups=1000(plex)
  2. Next install the cifs tools, if they are not already installed
    [root@dl01 ~]# yum install cifs-utils -y
    Loaded plugins: fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
    * base: pkg.adfinis-sygroup.ch
    * centos-sclo-rh: pkg.adfinis-sygroup.ch
    * centos-sclo-sclo: pkg.adfinis-sygroup.ch
    * elrepo: ftp.nluug.nl
    * epel: pkg.adfinis-sygroup.ch
    * extras: pkg.adfinis-sygroup.ch
    * nux-dextop: mirror.li.nux.ro
    * updates: pkg.adfinis-sygroup.ch
    Package cifs-utils-6.2-10.el7.x86_64 already installed and latest version
    Nothing to do
  3. Now we will create a credential file to store our login information, make sure to save it with 0600 rights in a place only root can get to
    [root@dl01 ~]# touch /root/creds_smb_plex
    [root@dl01 ~]# chmod 0600 /root/creds_smb_plex
    [root@dl01 ~]# nano /root/creds_smb_plex

    username=yourUserName
    password=yourPassword
    domain=yourDomainOrFileServerName
    /root/creds_smb_plex
  4. As a next step we will create an entry in our /etc/fstab to mount the share from our fileserver. Make sure to use the option _netdev.
    #
    # /etc/fstab
    # Created by anaconda on Fri May 18 21:37:46 2018
    #
    # Accessible filesystems, by reference, are maintained under '/dev/disk'
    # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
    #
    /dev/mapper/centos_dl01-root / xfs defaults 0 0
    UUID=e208aec6-bc3b-4524-8ac1-009ce34239a3 /boot xfs defaults 0 0
    /dev/mapper/centos_dl01-swap swap swap defaults 0 0
    //fns01.exera.ch/movies /mnt/movies cifs credentials=/root/creds_smb_plex,uid=1000,gid=1000,file_mode=0770,dir_mode=0770,iocharset=utf8,_netdev 0 0
  5. Before we now restart the machine, make sure to enable the “NetworkManager-wait-online.service” Service
    [root@dl01 ~]# systemctl enable NetworkManager-wait-online.service
  6. Now we can reboot the machine and the share should be mounted on startup. To check if your share is present, use the following command
    [root@dl01 ~]# cat /proc/mounts
    //fns01.exera.ch/movies /mnt/movies cifs rw,relatime,vers=default,cache=strict,username=plex,domain=fns01,uid=1000,forceuid,gid=1000,forcegid,addr=10.1.0.50,file_mode=0770,dir_mode=0770,soft,nounix,serverino,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,actimeo=1 0 0