Ubuntu: Do “personal fstab” files exist for user accounts?



Question:

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?


Solution:1

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:


Solution:2

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  


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


Solution:4

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.


Solution:5

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.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »