Permanent mount fails at boot time

Hello,

Your help would be appreciated in helping me solve the following problem.

I defined a permanent mount (as explained there) in /etc/fstab by adding the final line below (real password hidden) :

arizona:~ # cat /etc/fstab
/dev/disk/by-id/ata-FUJITSU_MHT2060AH_PL_NP1WT572FTRY-part5 swap                 swap       defaults              0 0
/dev/disk/by-id/ata-FUJITSU_MHT2060AH_PL_NP1WT572FTRY-part6 /                    ext4       acl,user_xattr        1 1
/dev/disk/by-id/ata-FUJITSU_MHT2060AH_PL_NP1WT572FTRY-part7 /home                ext4       acl,user_xattr        1 2
/dev/disk/by-id/ata-FUJITSU_MHT2060AH_PL_NP1WT572FTRY-part1 /windows/C           ntfs-3g    defaults,locale=fr_FR.UTF-8 0 0
proc                 /proc                proc       defaults              0 0
sysfs                /sys                 sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
devpts               /dev/pts             devpts     mode=0620,gid=5       0 0
//10.0.1.202/ben     /home/ben/vegas      cifs       username=ben,password=MY_PASSWORD,_netdev,uid=ben,gid=users   0 0

But the share is not mounted at boot time :(. The syntax seems good since a call to ‘mount -a’ succeeds, after boot.

I have tried all the suggestions from swerdna’s website, to no avail. I don’t know if activating the cifs and smb services is required or not (doesn’t seem to make any difference). Couldn’t find any ‘smbfs’ system service - is it now cifs??

Thanks for your help :).

Yes, they changed the name of the helper daemon from smbfs in 11.2 to cifs in 11.3

Just a guess but, since the boot process is now done in parallel to speed things up, maybe the required network is not fully up and running at the time the fstab is run.

Problem fixed by adding the following entry in crontab:

@reboot sleep 10;mount -a

So for some reason the network was not up and running when the fstab file was being read.

Yes gogalthorp, I agree. And to help that situation one enables the cifs daemon in the runlevels configurator in Yast. I also include the option _netdev in the mount entry in fstab. I also think the file after.local in /etc/init.d can be set to help, but maybe it’s not necessary to go further at this time, pending advice from OP.

Ah yes, that old trick. Sad to have to use it, but if it works, then life continues.

Another problem now…
I would like to hide my login/password in a .creds file (only readable/writable by me - user ben), and change the fstab entry to:

//10.0.1.202/ben     /home/ben/vegas      cifs       credentials=/home/ben/.creds,_netdev,uid=ben,gid=users   0 0

But mount fails again, this time with the following error:

arizona:~ # mount -a
Password: 
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

Any advice?..

What’s in the file? two lines like
username=value1
password=value2

And, what’s the console return for this command:

ls -la /home/ben | grep reds

Hello swerdna,

ben@arizona:~> cat /home/ben/.creds 
username=ben
password=MY_PASSWORD
ben@arizona:~> ls -la /home/ben | grep reds 
-rw-------  1 ben  users    32 aoû 15 17:03 .creds

(Real password obviously replaced by “MY_PASSWORD”)

Here’s the problem [perhaps :slight_smile: ]:

-rw-------  1 ben  users    32 aoû 15 17:03 .creds

says that user ben can read and write but everyone else is forbidden. Change it to -rw-r–r-- ans see if it improves

PS: can use “chmod 644” see here: Notes on chown and chmod

On 2010-08-16 18:52, swerdna wrote:
>
> Here’s the problem [perhaps :slight_smile: ]:
>
> Code:
> --------------------
> -rw------- 1 ben users 32 aoû 15 17:03 .creds
> --------------------
>
> says that user ben can read and write but everyone else is forbidden.
> Change it to -rw-r–r-- ans see if it improves

That’s impossible, that’s a huge security problem! The file must be readable by the owner and nobody
else, as it holds passwords.

Having it world readable is the same as having the password written in fstab.

The solution has to be different.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” GM (Elessar))

Having it world readable is the same as having the password written in fstab.

Careful of the B.P. there Carlos :slight_smile:
Maybe it would be better if the file was made over to group:user = root:root and left as -rw-------, that might satisfy you?

Yeah, that sounds better, try that oysterboy

I think I’m giving up… Changing the user/group/permissions of the credentials file doesn’t help (for testing purposes, I even tested with owner and group=root, -rwxrwxrwx, and the mount still fails!).

But after all, I thought it made more sense to mount the share manually when needed, so I wrote the following script, to be executed as root.

#!/bin/bash
echo -e "ben's password: \c "
read  password
mount -t cifs -o username=ben,password=$password,uid=ben,gid=users //10.0.1.202/ben /home/ben/vegas

The script works, although I don’t know if it’s “well” written (I’m a bash noob :)).

Thanks anyway for all the tips!

On 2010-08-17 00:06, oysterboy wrote:
>
> I think I’m giving up… Changing the user/group/permissions of the
> credentials file doesn’t help (for testing purposes, I even tested with
> owner and group=root, -rwxrwxrwx, and the mount still fails!).

You could perhaps trying to put the file somewhere else, like (etc. In fact, the manual doesn’t say
that you can specify a path to “credentials”.

> But after all, I thought it made more sense to mount the share manually
> when needed, so I wrote the following script, to be executed as root.
>
>
> Code:
> --------------------
> #!/bin/bash
> echo -e "ben’s password: \c "
> read password
> mount -t cifs -o username=ben,password=$password,uid=ben,gid=users //10.0.1.202/ben /home/ben/vegas
> --------------------
>
>
> The script works, although I don’t know if it’s “well” written (I’m a
> bash noob :)).

From man mount.cifs:

password=arg
specifies the CIFS password. If this option is not given then the environment
variable PASSWD is used. If the password is not specified directly or
indirectly via an argument to mount, mount.cifs will prompt for a password,
unless the guest option is specified.

You do not need to ask for the pasword yourself.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” GM (Elessar))