How to enable non-root user to mount partitions on usb device
By default non root user can not auto mount an external USB drive partition. To allow non-root user to mount external USB drive partition you should do the following:
- add the user name to group plugdev (edit /etc/group)
- edit /etc/login.defs and add to the line with CONSOLE_GROUPS the group plugdev
- logout and login
assuming that user name is “xyzt2″ then your /etc/group file will look similar to this:
root@magelan:/home/xyzt2# cat /etc/group | grep xyzt2 wheel:x:10:root,xyzt2 audio:x:17:xyzt2 cdrom:x:19:xyzt2 plugdev:x:83:xyzt2
and /etc/login.defs will have the line
CONSOLE_GROUPS floppy:audio:cdrom:video:scanner:plugdev
What I usually do is also to give rights to this user to mount the cdrom also
Where is the mount point
use command “mount” in the console to see where the partition is mountedusually it is under directory /media and the name of the mount point is the volume label of the partition for exampel
mount ... /dev/sdb6 on /media/ntfs320 type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,default_permissions) /dev/sdb1 on /media/disk type reiserfs (rw,nosuid,nodev,uhelper=hal)
Adding permanent entry in /etc/fstab
Another thing which is important to explain here is that /etc/fstab is also important. Lets assume that you have several partitions on your usb drive. For example:
root@magelan:/home/xyzt2# fdisk -l /dev/sdb ... Device Boot Start End Blocks Id System /dev/sdb1 63 40017914 20008926 83 Linux /dev/sdb2 40017915 100036754 30009420 83 Linux /dev/sdb3 * 100036755 160055594 30009420 af HFS / HFS+ /dev/sdb4 160055595 625137344 232540875 5 Extended /dev/sdb5 239995098 474383384 117194143+ c W95 FAT32 (LBA) /dev/sdb6 474383448 625137344 75376948+ 7 HPFS/NTFS/exFAT /dev/sdb7 160055658 168055964 4000153+ 82 Linux swap /dev/sdb8 168056028 239995034 35969503+ 83 Linux ...
and you have a line in your /etc/fstab like this:
/dev/sdb5 /mnt/dos320 vfat uid=1000 0 0
What will happen is that you will not be able to auto mount partition /dev/sdb5 but you will be able to auto mount all other partitions like this one /dev/sdb6. The error that you will see in KDE will be:
“mount: only root can mount /dev/sdb5 on /mnt/dos320″.
What you should do is to add options “user” to the /etc/fstab entry for that partition. And your /etc/fstab will look like this:
/dev/sdb5 /mnt/dos320 vfat uid=1000,user 0 0