Ubuntu – Hard disk icon disappears after mounting

hard drive

I installed ubuntu 11.10. During installation, I created the default user (named MS). I can browse/edit and do anything in my hard disk(I have 7 partitions).

Today I created a new user named (ABC), this user cannot access my internal hard disk partitions. When I click on each partition the hard disk icon suddenly disappear from the left side device panel(inside home folder there is things like devices, bookmarks etc). So I checked /media directory and it says "folder contents cannot be displayed".

cat /etc/fstab

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc                                       /proc        proc  nodev,noexec,nosuid  0  0  
# / was on /dev/sda1 during installation
UUID=9fa65e41-5c75-4636-a3b5-961739b245c2  /            ext4  errors=remount-ro    0  1  

fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b2307

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1            2048    39997439    19997696   83  Linux

/dev/sda2   *    39999488    81946623    20973568   83  Linux

/dev/sda3        81947565   123877214    20964825   83  Linux

/dev/sda4       123887614   976773119   426442753    5  Extended

/dev/sda5       123887616   333602815   104857600   83  Linux

/dev/sda6       333604864   543320063   104857600   83  Linux

/dev/sda7       543322112   753037311   104857600   83  Linux

/dev/sda8       753039360   976773119   111866880   83  Linux

Information about the users

id ms
uid=1000(ms) gid=1000(ms) groups=1000(ms),4(adm),20(dialout),24(cdrom),46(plugdev),116(lpadmin),118(admin),124(sambashare)

id abc
uid=1002(abc) gid=1002(abc) groups=1002(abc),4(adm),20(dialout),24(cdrom),46(plugdev),116(lpadmin),118(admin),124(sambashare)

Also I got the following things while mounting the partition under the user abc.

Dec 21 23:04:15 ms-Lenovo-G550 kernel: [   64.093923] EXT4-fs (sda8): warning: maximal mount count reached, running e2fsck is recommended
Dec 21 23:04:15 ms-Lenovo-G550 kernel: [   64.095606] EXT4-fs (sda8): recovery complete
Dec 21 23:04:15 ms-Lenovo-G550 kernel: [   64.095611] EXT4-fs (sda8): mounted filesystem with ordered data mode. Opts: (null)
Dec 21 23:04:16 ms-Lenovo-G550 kernel: [   65.619595] EXT4-fs (sda7): recovery complete
Dec 21 23:04:16 ms-Lenovo-G550 kernel: [   65.619602] EXT4-fs (sda7): mounted filesystem with ordered data mode. Opts: (null)
Dec 21 23:04:17 ms-Lenovo-G550 kernel: [   66.250818] EXT4-fs (sda6): warning: maximal mount count reached, running e2fsck is recommended
Dec 21 23:04:17 ms-Lenovo-G550 kernel: [   66.251195] EXT4-fs (sda6): recovery complete
Dec 21 23:04:17 ms-Lenovo-G550 kernel: [   66.251362] EXT4-fs (sda6): mounted filesystem with ordered data mode. Opts: (null)
Dec 21 23:04:18 ms-Lenovo-G550 kernel: [   67.080910] EXT4-fs (sda5): recovery complete
Dec 21 23:04:18 ms-Lenovo-G550 kernel: [   67.080916] EXT4-fs (sda5): mounted filesystem with ordered data mode. Opts: (null)

Here are the result of /media after mounting partitions.

abc@ms-Lenovo-G550:~$ ls -al /media/

total 28
drwxr-xr-x  7 root root 4096 2011-12-29 07:34 .
drwxr-xr-x 24 root root 4096 2011-12-11 22:30 ..
drwxrw----  6 ms   ms   4096 2011-11-19 15:45 Films
drwx------ 17 ms   ms   4096 2011-12-22 21:59 Misc
dr-x------  9 ms   ms   4096 2011-12-20 23:18 Ms
drwx------  6 ms   ms   4096 2011-12-28 18:50 Softs
drwx------  6 ms   ms   4096 2011-11-17 03:06 Song

Also different partitions are used to arrange things in an easy manner.

Thanks,
Vipin MS

Best Answer

Your problem is with the user/group permissions on ext4. For abc to access read only, you need to set the permissions to 755 (on eg. /home/Ms) with

sudo chmod -R 755 /media/Ms

This will grant read only access for all the users on the system. If you want more security create a new group, add the two users to that group, and chown + chmod

sudo groupadd new_group
sudo usermod -a -G new_group ms
sudo usermod -a -G new_group abc
sudo chown ms:new_group -R /media/Ms
sudo chmod 770 -R /media/Ms

This will set the permissions to rwxrwx---, and only the two users can access the Ms folder.

Related Question