Mounting on startup in 12.04

Nils Kassube kassube at gmx.net
Tue Mar 18 07:49:46 UTC 2014


TopBot . wrote:
> On Tue, Mar 18, 2014 at 1:44 AM, Nils Kassube <kassube at gmx.net> wrote:
> > su USER -c "udisks --mount /dev/disk/by-label/Data"

> Okay, I just added this to rc.local (replaced user with my actual
> username) and rebooted... the device wasn't mounted on startup. Then
> I tried this command manually in terminal:
> 
> user at mypc:~$ su user -c "udisks --mount /dev/disk/by-label/Data"
> 
> > Password:
> > Mount failed: Not Authorized
> > user at mypc:~$

Well, I wasn't aware of that behaviour of udisks - maybe I should have 
tested the command ...

While you tried the command as user and not as root (because rc.local is 
run by root), the output would be the same. It seems like the udisks 
command uses some feature which is tied to the individual GUI session. 
Then there are two options which have already been mentioned before: You 
could use a script which is run as an autostart command of the GUI 
session or you could use an fstab entry. I would suggest to use the 
first option because in another mail you wrote

| My case was that I do not want to do this permanently and do not want
| to create backup versions of fstab, yet I want to disable this auto
| mount just by removing or commenting the command which would be much
| easier (I guess?) than editing fstab esp. in the cases when I'm
| setting the same up for some one else (I find it easier to just go by
| label and add a single command). I haven't edited fstab before, but if
| there's something equally simple for that too, I would be open to that
| too.

If don't want this to be a permanent feature, it is better to use a 
script which is controlled by the user, not by root. IMHO there is no 
difference if you disable the command by commenting it in rc.local or by 
commenting the appropriate line in fstab. In both cases you are working 
with system files which is only allowed for root and errors may be 
fatal.


Nils





More information about the ubuntu-users mailing list