3

When I write ls -la the output is :

tusharmakkar08-Satellite-C660 tusharmakkar08 # ls -la
total 88
drwxr-x---+ 10 root root  4096 Apr 18 19:43 .
drwxr-xr-x   4 root root  4096 Mar 18 17:35 ..
drwxr-xr-x   4 root root 32768 Jan  1  1970 CFB1-5DDA
drwxrwxrwx   2 root root  4096 Feb 23 00:09 FA38015738011473
drwxrwxrwx   2 root root  4096 Apr 17 14:00 Local
drwxrwxrwx   2 root root  4096 Mar 19 05:04 Local\040Disk1
drwxrwxrwx   2 root root  4096 Apr 18 19:43 Local\134x20Disk1
drwxrwxrwx   2 root root  4096 Feb 23 00:09 Local Disk
drwxrwxrwx   1 root root 24576 Apr 19 15:15 Local\x20Disk1
drwxrwxrwx   2 root root  4096 Feb 23 00:08 PENDRIVE

Now I want to change the permissions of CFB1-5DDA .. but i am unable to do so . When I write

chmod 777 CFB1-5DDA

still the permissions remain unchanged. The output of

sudo blkid -c /dev/null

is

tusharmakkar08-Satellite-C660 tusharmakkar08 # sudo blkid -c /dev/null
/dev/sda2: UUID="FA38015738011473" TYPE="ntfs" 
/dev/sda3: LABEL="Local Disk" UUID="01CD72098BB21B70" TYPE="ntfs" 
/dev/sda4: UUID="2ca94bc3-eb3e-41cf-ad06-293cf89791f2" TYPE="ext4" 
/dev/sda5: UUID="CFB1-5DDA" TYPE="vfat"

The output of

cat /etc/fstab 

is

tusharmakkar08-Satellite-C660 tusharmakkar08 # cat /etc/fstab
# /etc/fstab: static file system information.
#
#                

#Entry for /dev/sda4 :
UUID=2ca94bc3-eb3e-41cf-ad06-293cf89791f2   /   ext4    defaults    01
#Entry for /dev/sda2 :
UUID=FA38015738011473   /media/sda2 ntfs-3g defaults,locale=en_IN   0   0
#Entry for /dev/sda5 :
UUID=CFB1-5DDA  /media/tusharmakkar08/CFB1-5DDA vfat    defaults    0   0
/dev/sda3   /media/tusharmakkar08/Local\134x20Disk1 fuseblk defaults,nosuid,nodev,allow_other,blksize=4096  0   0
/dev/sda3   /media/tusharmakkar08/Local\x20Disk1    ntfs-3g defaults,nosuid,nodev,locale=en_IN  0   0

#/dev/sda3  /media/tusharmakkar08/Local\134x20Disk1 ntfs    defaults,nls=utf8,umask=0222,nosuid,nodev   0   0

And the output of

mount

is

tusharmakkar08-Satellite-C660 tusharmakkar08 # mount
/dev/sda4 on / type ext4 (rw)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
cgroup on /sys/fs/cgroup type tmpfs (rw,relatime,mode=755)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu type cgroup (rw,relatime,cpu)
cgroup on /sys/fs/cgroup/cpuacct type cgroup (rw,relatime,cpuacct)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,relatime,freezer)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,relatime,perf_event)
/dev/sda2 on /media/sda2 type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)
/dev/sda5 on /media/tusharmakkar08/CFB1-5DDA type vfat (rw)
/dev/sda3 on /media/tusharmakkar08/Local\x20Disk1 type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfsd-fuse on /run/user/tusharmakkar08/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=tusharmakkar08)
2
  • Which partition are you accessing that's giving you the permissions issues?
    – slm
    Commented Apr 28, 2013 at 14:16
  • I am having issues with CFB1-5DDA Commented Apr 28, 2013 at 14:49

2 Answers 2

5

chmod 777 CFB1-5DDA fails because CFB1-5DDA is a mount point and the mounted file system is vfat. So you are trying to write meta data to a file system which the file system does not support (i.e. cannot store). Simple as that.

strace chmod 777 CFB1-5DDA shows you the kernel error.

In order to change the access rights you have to change the mount (-o remount or umount; mount).

5
  • 1
    I am still having problem . When I do umount and chmod 777 CFB1-5DDAand then do ls -la It shows the changed permissions but when I again mount it the permissions remain unchanged. Can U please elaborate on how to do this ? Commented Apr 28, 2013 at 14:48
  • 1
    @TusharMakkar That is an easily explaied misunderstanding by you. You don't see the same directory in both cases. Once you see the mount point directory in your Linux file system (which can store these access rights), in the other case you see the root directory of the mounted volume. The meta data would probably change even if you mounted an e.g. ext3 partition because the FS root folder always covers the mount point. You can cd into the moint point from another shell. ls -ld will show you the old data even after mounting. Have a look at the vfat mount options. Commented Apr 28, 2013 at 14:52
  • 2
    Thanks a lot ... This worked sudo mount -t vfat /dev/sda5 CFB1-5DDA -o uid=0,gid=0,umask=000 Commented Apr 28, 2013 at 16:03
  • 1
    This link was useful for finding the way out. Commented Apr 28, 2013 at 16:04
  • 1
    @TusharMakkar's comment much more useful than the chosen answer.
    – Hi-Angel
    Commented Mar 1, 2015 at 17:55
1

I couldn't figure out which partition/mount is actually backing the directory/files that are giving you permissions problems.

If it's an NTFS or possibly one of the fuse ones then the permissions displayed on your client can be misleading. They aren't necessarily the actual permissions. The true permissions for these are governed by the actual account that's doing the mounting of the NTFS/FUSE share.

For the true permissions you'll likely have to look to the originator of the permissions (i.e. the machine sharing the files out), rather than the client side.

For example

Here I'm mounting a Samba share using mount.cifs. Prior to mounting the share, the directory where I'll be mounting it to (aka. the mount point) is permissioned like so:

$ ls -dl /mnt
drwxr-xr-x. 5 root root 4096 Apr 20  2011 /mnt/

The contents of this directory are as follows:

$ ls -la /mnt
total 20
drwxr-xr-x.  5 root root 4096 Apr 20  2011 .
drwxr-xr-x. 26 root root 4096 Apr 26 08:11 ..
drwxr-xr-x.  2 root root 4096 Dec 28  2010 m1
drwxr-xr-x   2 root root 4096 Apr 20  2011 test1
drwxr-xr-x   2 root root 4096 Apr 20  2011 test2

Now I mount my Samba share "sam" coming from server "bart" using the user account "sam".

NOTE: the user account "sam" is local to the server "bart" not my local machine.

$ mount -t cifs //bart/sam -o username=sam /mnt

Now let's see what /mnt looks like:

$ ls -ld /mnt/
drwxr-x--- 123 5060 1000 0 Apr 28 12:14 /mnt/

$ ls -l /mnt/ | head -5
total 72828
drwxr-xr-x  3 5060 users        0 Oct 23  2009 backup_archives
-rw-r--r--  1 5060  1000     9907 Jan 31 14:39 bashrc
-rw-r--r--  1 root root     50664 Oct 10  2007 bg_body.png
drwxr-xr-x  4 5060 users        0 Mar 16  2012 bin

The permissions that the directory /mnt had previously are gone, so long as we have the Samba share mounted to this location. The original /mnt is not gone, if we were to unmount /mnt the original /mnt is still there, mounting does not destroy the contents of a directory under which you're mounting on top.

NOTE: The userid is displayed as 5060, more evidence that you're dealing with a remote file system that the local system has no knowledge of these user ids.

key points to remember

  • The files that are being displayed are not truly part of the local filesystem
  • permissions are dictated by the server of the files, not the clients
  • mounting technologies are inherently different, so you need to pay attention to which ones are being used where

You must log in to answer this question.

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