I'm looking for a "personal" equivalent for the /etc/fstab
file, that apply only on my account (on login); does such a file exists? Or is it more complicated?
5 Answers
In case we need to always mount a drive after we log in to our account but do not want this drive mounted at boot we may want to consider mounting by udisks. Below command will e.g. mount the drive ``/dev/sdc1to
/media/` (no root permissions needed):
udisks --mount /dev/sdc1
This command can be added to a script, or put in autostart applications if needed.
See also these related questions here:
-
You beat me on this, Yes,
udisks
can be a very good alternative forfstab
and can be used as personal fstab. It has got even better in 13.04.– AnwarOct 24, 2013 at 11:27
No you can not. But it is not too complicated to do: all you need to do is create a script that manually adds the mount points you need and execute that script from your login.
Lets assume this is the fstab entry for a personal mount that you want only mounted if you login:
# volume mount point type options
news:/usr/spool/news /usr/spool/news nfs timeo=14,intr
the manual mount could be:
mount news:/usr/spool/news
So if you put this in a script (cd ~ && gedit mount_them.sh
) and make the script executable you can add this script to your .bash_profile or .bashrc (.bash_profile is executed for login shells, while .bashrc is executed for interactive non-login shells). Adding something like this (pseudo code) would mount them for you:
if [ -f ~/mount_them.sh ]; then
./mount_them.sh
fi
-
2
-
1@joni No, all you need is to set the permissions correctly. See kmandla.wordpress.com/2007/03/08/howto-mounting-without-sudo for a thorough example.– RinzwindOct 24, 2013 at 11:34
-
1In that case you should add
user
orusers
to the mount options; the example you give can only be mounted by root.– JoniOct 24, 2013 at 12:32
A similar command to Takkat's is the following:
udisksctl mount -b /dev/sdc1
this will mount the device /dev/sdc1
to the following location (just like Nautilus would do it)
/media/$USER/$DEVICE
where $USER
is your username and $DEVICE
is the device label if it is set, otherwise it is the device UUID.
Note: The manpage for this command exists only in 12.10+, so I'm assuming this is only available for 12.10+.
Do you mean that you have several users of your system and you want them to have different access rights to different volumes on your machine?
If so, then we're in the same boat. I have a 'common' NTFS drive that I want to be available to any user of my machine. On the other hand I also have a 'work' NTFS drive that should be accessible only by me (save root, of course, but then again that's me).
To achieve this I edited /etc/fstab
the following way:
# 'COMMON' drive for all
UUID=XXXXXXXXXXXXXXX /media/COMMON ntfs rw,auto,users,exec,nls=utf8 0 0
# 'WORK' drive for me only
UUID=XXXXXXXXXXXXXXX /media/WORK ntfs defaults,uid=1000,gid=1000,umask=007 0 0
Note: you need to have create respective subdirectories (/COMMON, /WORK) in /media directory first.
If you happen to use KDE, you can go to
System Settings->Hardware->Removable Devices and check the appropriate box next to your partition. The options are Automount on Login and Automount on Attach.
This has been available for awhile - I think since karmic. Since it's part of the desktop, I'm pretty sure these settings would apply on a per user basis.
only
your user to be able to mount these partitions. If you want something like that then something further will be required. The difference with fstab is that it's a system file and only a superuser can modify it.