[Samba] passwords for Samba mounts in /etc/fstab

Michael Marano michael.marano at m23.com
Mon Sep 23 20:19:01 GMT 2002

I am trying to create a samba mount to be mounted automatically on a Redhat 7.2 machine.  
I can mount the drive from the command line, but would like to have the drive mount on boot.
I have added it to /etc/fstab, and get prompted for a password when I run mount on it from the 
command line.  I know it is possible to pass the "password" option, or the "credentials" option
to mount the drive.  My problem with either of these paradigms is that I have to have a password
in plaintext.  The samba share I am mounting isn't a public share, and shouldn't be.  I'm not sure
how to get around this properly.   My current entry in /etc/fstab looks like:
	\\server_name\share_dir   /mnt/dir        smbfs   auto    0 0
I know I could do:
	\\server_name\share_dir   /mnt/dir        smbfs   auto,password=foo    0 0
	\\server_name\share_dir   /mnt/dir        smbfs   auto,credentials=/some/filename    0 0
	where /some/filename looks like
	username = bar
	password = foo
I tried the credentials method, but couldn't access the file when it was chown root.root, chmod 0600.
Even if I got the permissions proper I would have a password in plaintext.  That doesn't seem like a 
great plan to me, but perhaps someone could convince me that if I do it properly it is feasible.
It would seem ideal to have it be able to use some encrypted password, and I'm hoping someone
could tell me a way to do that.

A subsidiary question about mounting a network drive on startup:  Is the init process smart enough
to only mount network drives once the network is up, which I beleive happens after the mounts?

Thanks for the help.


More information about the samba mailing list