Create credential storage
Create file /etc/samba/credential
:
1 2 3
| username=<smb username> password=<smb password> domain=<optional domain name>
|
Change permission to allow credential read only by root:
1
| sudo chmod 600 /etc/samba/credential
|
Edit fstab
In /etc/fstab
:
1 2
| # <file system> <mount point> <type> <options> <dump> <pass> //my-server/share /mnt/my-server cifs credentials=/etc/samba/credential,uid=1000,gid=1000 0 0
|
Use uid=1000,gid=1000
option to mount the share as user.