Mounting on startup in 12.04

Nils Kassube kassube at gmx.net
Mon Mar 17 20:44:02 UTC 2014


TopBot . wrote:
> udisks --mount /dev/disk/by-label/Data
> 
> It works great as a manual command in terminal but when i try to mount
> the drive "Data" using the same command on startup by using the
> command via rc.local, the data drive disappears from the side panel
> and when I try to open it from /media/Data it says I do not have the
> permissions to access content from the drive (which is not the issue
> if i do it on normal basis)..

The script rc.local is run by root at startup. Therefore root becomes 
the owner of the mounted drive if it is a FAT32 partition. OTOH if you 
used a ext2/3/4 partition the permissions would be stored in the 
filesystem for the individual files and it would work as expected 
(except only root can unmount the disk). So if you always want to mount 
it as the same user, you can modify the command like this:

su USER -c "udisks --mount /dev/disk/by-label/Data"

Replace the "USER" appropriately.


Nils





More information about the ubuntu-users mailing list