The eternal fight between admins and computers

(and very often users, as well)

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!

3 Responses to “HOWTO: mount samba shares in fstab using a credential file”

  1. Marc said

    com va tot tros de marica?

    et trobo a faltar tontu! siiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii! jejejejeje

    1 abraçada

  2. Paul Roach said

    Good tip :)

    Many thanks…..

  3. 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.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>