[linux-cifs-client] mount.cifs in /etc/fstab with credentials file

Jeff Layton jlayton at redhat.com
Mon Jul 30 13:24:14 GMT 2007


On Mon, 30 Jul 2007 03:10:50 -0400
Mark Anthony Rodriguez <mrodriguez at alum.rpi.edu> wrote:

> Hello,
> 
> This problem has been troubling me and it may be easy to solve.  I am
> using Fedora 7 and I have entered the appropriate lines in my /etc/fstab
> file to mount some samba shares using the credentials file option ex:
> //servename/media_files /mnt/medi_files       cifs
> auto,credentials=/home/guest/.credentials.guest,iocharset=u
> tf8,file_mode=0777,dir_mode=0777 0 0
> 
> where I have the username and password and no spaces in the
> file /home/guest/.credentials.guest 
> 
> I have chmod the file to 770 (less conservative than 600 or 700).
> During bootup I get the error message that 
> error 13 error opening credentials file /home/guest/.credentials.guest
> 
> Now after the boot up process, as root, I can manually type mount -a and
> the share is mounted.
> 
> I believe the problem may be that at the time /etc/fstab is being
> processed I don't have sufficient privileges to read a credential file.
> Any idea as to what is going on and possible solutions?  I guess I could
> right a script to be executed at each user's login, but it seems less
> than elegant.
> 

It may be SELinux-related. I believe init scripts run in a particular
SELinux context and that likely doesn't have permission to read this
file. You might want to look at dmesg after boot and look for AVC
denial messages that refer to that file.

If that's the issue then using 'chcon' to change the security context
of the file to match something that the process can read might be a good
workaround.

-- 
Jeff Layton <jlayton at redhat.com>


More information about the linux-cifs-client mailing list