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.
From the mount.cifs manpage:
Use the credentials option such as:
http://www.justlinux.com/nhf/Filesystems/Mounting_smbfs_Shares_Permanently.html
Example from the website:
Substitute your Windows username and password in the commands. No one else except root would be able to read the contents of this file.
Once that is created, you would modify the line in the /etc/fstab file to look like this:
example from /etc/fstab:
janneb's post and the link to man page show what needs to be present in the credentials file.
So I'm accumulating both answers
Create file, e.g. /root/.cifs
set permission
600
(rw- permission) to protect your credentialspass
credentials=/root/.cifs
to your command instead ofusername=
andpassword=
Could try cifscloak
pip3 install cifscloak
https://github.com/sudoofus/cifscloak