HOWTO: mount samba shares in fstab using a credential file
Posted by rga on December 17, 2007
Hello,
If you want to mount share files using samba but you don’t want to put the username or password on fstab file, you could use an external file, this is useful if you want to increase a little security since fstab usually is world readable.
Using /etc/fstab
# insecure and common usage
//share/dir /mnt/myshare cifs username=user,password=pass
# more secure usage
mkdir /path/securedir
chmod 0700 /path/securedir
chown root /path/securedir
//share/dir /mt/myshare cifs credentials=/path/securedir/fileshare
cat /path/securedir/fileshare
username=yourusername
password=youpass
As you can see, it’s easy and increase a little security if more users can access in you machine.
of course you can use smbmount too:
smbmount //share/dir /mnt/myshare -o credentials=/path/securedir/fileshare
See you!
Marc said
com va tot tros de marica?
et trobo a faltar tontu! siiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii! jejejejeje
1 abraçada
Paul Roach said
Good tip :)
Many thanks…..
Schop said
Great, I don’t want my pass in fstab!
THing is thoug that dmesg|tail still tells me no username is specified after a failure.