Store Authentication Information Outside of fstab for CIFS Mounting

fstablinuxmountpermissions

I am currently using cifs to mount some network shares (that require authentication) in /etc/fstab. It works excellently, but I would like to move the authentication details (username/pass) outside of fstab and be able to chmod it 600 (as fstab can have issues if I were to change its permissions). I was wondering if it is possible to do this (many-user system, don't want these permissions to be viewable by all users).

from:

//server/foo/bar /mnt/bar cifs username=user,password=pass,r 0 0

to:

//server/foo/bar /mnt/bar cifs <link to permissions>,r 0 0

(or something analogous to this). Thanks.

Best Answer

From the mount.cifs manpage:

credentials=filename
    specifies a file that contains a username and/or password. The format of the file is:

                         username=value
                         password=value
   This is preferred over having passwords in plaintext in a shared file, such as /etc/fstab. Be sure to protect any credentials file properly.

Related Topic