Redhat CIFS mounting with FSTAB and credentials file

As the root user:

Create files in /etc/smbmounts for each set of credentials you need to mount various windows fileserver shares

i.e. server1,server2, and server3 or domain1,domain2, and domain3

or hide these files by naming .server1 .....

Example file serverX should contain the following with no whitespaces

username=windowsusername

password=windowspassword

domain=windowsdomain

chmod 600 on the serverX or domainX or whatever name you chose for them

Edit /etc/fstab and add the following to the end:

# For a password protected rw share

//servername/sharename /mount/sharename cifs credentials=/etc/smbmounts/.server1,iocharset=utf8,file_mode=0777,dir_mode=0777 1 3

# For a read only share

//servername/sharename /media/sharename cifs guest,iocharset=utf8 1 3

1 comment:

Alex Filonov said...

Great! Thanks for the info, saved me hours.