17

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?

4
  • No you can't get a individual fstab Entry for every Account Oct 24, 2013 at 10:33
  • What are you trying to achieve, mount a certain volume on login? Only a single volume, just for your account, or different volumes for each user?
    – Joni
    Oct 24, 2013 at 10:52
  • You can use gvfs to do something similar.
    – MadMike
    Oct 24, 2013 at 10:56
  • The answers below tell you how to get it mounted, but none of them (including mine) deal with the possibility that you may want 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.
    – Joe
    Oct 30, 2013 at 20:14

5 Answers 5

14

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:

1
  • You beat me on this, Yes, udisks can be a very good alternative for fstab and can be used as personal fstab. It has got even better in 13.04.
    – Anwar
    Oct 24, 2013 at 11:27
4

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
3
  • 2
    Don't you have to be root to be able to use mount?
    – Joni
    Oct 24, 2013 at 10:54
  • 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.
    – Rinzwind
    Oct 24, 2013 at 11:34
  • 1
    In that case you should add user or users to the mount options; the example you give can only be mounted by root.
    – Joni
    Oct 24, 2013 at 12:32
3

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+.

0

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.

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .