fstab and cifs mounting, possible to store authentication information outside of fstab?
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.
Use the credentials option such as:
Example from the website:
cd echo username=mywindowsusername > .smbpasswd echo password=mywindowspassword >> .smbpasswd chmod 600 .smbpasswd
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:
//servername/sharename /mountdirectory smbfs credentials=/home/myhomedirectory/.smbpasswd 0 0
example from /etc/fstab:
//server/share/ /mnt/localmountpoint cifs credentials=/root/.creda
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
username=value password=value domain=value (optional)
600(rw- permission) to protect your credentials
# chmod 600 /root/.cifs
credentials=/root/.cifsto your command instead of