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!
com va tot tros de marica?
et trobo a faltar tontu! siiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii! jejejejeje
1 abraçada
Good tip :)
Many thanks…..
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.
You may need to install cifs-utils in order to use the credentials file – this would install /sbin/mount.cifs which is required for reading the credentials file….
Thanks, Michael. I was looking for this for a couple of days.
Regards
[…] so that read access is available only to the user launching the command. Here's an example: https://anothersysadmin.wordpress.com…edential-file/ Your script can, and I say should, use a similar system. Just set the lines in the file up as […]
[…] . data.txt echo "$name" echo "$password" I hope you realize that having/storing sensitive password information directly in a script or readable text file is a bit of a security risk. However, some systems, such as samba share mounting, already have a "credentials" option that operates pretty much the same way, since it's safer than including them directly in globally available files like fstab. https://anothersysadmin.wordpress.com…edential-file/ […]
[…] Warning: this will mean your username & password is stored in plain text view-able to all on the device, if this is going to be a problem you can use a credentials file, see https://anothersysadmin.wordpress.com/2007/12/17/howto-mount-samba-shares-in-fstab-using-a-credential… […]
[…] Jetzt noch das wichtigste zum Schluß, Backup auf ein Windows Share (http://cagewebdev.com/index.php/raspberry-pi-accessing-your-windows-shares/ und http://mein.homelinux.com/wiki/dienste/samba und https://anothersysadmin.wordpress.com/2007/12/17/howto-mount-samba-shares-in-fstab-using-a-credentia…). […]