Mount a CIFS Share on Linux for FileCloud

You might need to mount a CIFS network share on Linux, so that FileCloud server can use storage from devices over the network for both local storage as well as external shares.

Use these instructions to mount a CIFS share in a way that prevents that FileCloud from encountering any permission issues. 


Remote CIFS share path//
Local mount path/mnt/storage
CIFS userusername
CIFS passwordpassword
Apache user uid33. Note: check your server for the right uid
Apache user gid33. Note: check your server for the right gid


Ensure the command mount.cifs is present in your distro. Here is the list of packages that provide this utility in different distros.

Required Packages

Ubuntu: cifs-utils

Installing cifs-utils in Ubuntu
user@host:~$ sudo apt-get update
user@host:~$ sudo apt-get install cifs-utils


Use the following command to mount the CIFS share

Command Line
user@host:~$ mount -t cifs -o username=username,password=password,uid=33,gid=33,rw,nounix,iocharset=utf8,file_mode=0777,dir_mode=0777 // /mnt/storage

or if you have credential files at /root/.this-creds-file
user@host:~$ mount -t cifs -o credentials=/root/.the-creds-file,uid=33,gid=33,rw,nounix,iocharset=utf8,file_mode=0777,dir_mode=0777 // /mnt/storage

Auto Mounting

To perform auto mounting of windows share, you need to create a password file and use that in /etc/fstab. Follow the steps here:

  1. Create a file /root/.smbcredentials with the following content.

    Command Line

    Here winuser and winpass are the username and password for the remote CIFS share.

  2. Change the permissions such that only root can read the file.

    Command Line
    # sudo chmod 700 /root/.smbcredentials
  3. Now add the following line in /etc/fstab file.

    Command Line
    // /mnt/storage        cifs    credentials=/root/.smbcredentials,uid=33,gid=33,rw,nounix,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0
  4. Test if the line added in the fstab file works.

    Command Line
    # sudo mount -a
    If you are getting any error while mounting like " host not found ", add version as below at the end of dir_mode=0777 as shown in the below// /mnt/storage cifs credentials=/root/.smbcredentials,uid=33,gid=33,rw,nounix,iocharset=utf8,file_mode=0777,dir_mode=0777,vers=3.0 0 0

    Now the remote share should be mounted at /mnt/storage.