fstab ignoring uid attribute when binding

Kernels & Hardware, configuring network, installing services

fstab ignoring uid attribute when binding

Postby javiribera » 2013-01-30 16:50

Hi all,

By now, using a mask and changing ownership when mounting a partition as usual is working OK:

Code: Select all
/dev/sda2       /media/javiribera       ntfs-3g defaults,uid=1001,gid=1002,dmask=027,fmask=137,locale=es_ES.utf8  0  3


But when binding a folder, fstab ignores it. After the previous line I have:

Code: Select all
/root/folderSource  /root/folderTarget  none  bind,uid=1001,gid=1002  0  0


But, as you can check, it's not working after a fresh reboot:
Code: Select all
root@raspberrypi:~# tree
.
├── folderSource
│   └── file
└── folderTarget
    └── file

2 directories, 2 files
root@raspberrypi:~# ls -lh
total 8,0K
drwxr-xr-x 2 root root 4,0K ene 30 17:56 folderSource
drwxr-xr-x 2 root root 4,0K ene 30 17:56 folderTarget
root@raspberrypi:~# ls -l folderSource/
total 0
-rw-r--r-- 1 root root 0 ene 30 17:56 file
root@raspberrypi:~# ls -l folderTarget/
total 0
-rw-r--r-- 1 root root 0 ene 30 17:56 file
root@raspberrypi:~#


Am I missing something? I couldn't find any solution in google.

Thank you!
User avatar
javiribera
 
Posts: 8
Joined: 2012-08-27 10:47

Re: fstab ignoring uid attribute when binding

Postby saulgoode » 2013-01-30 17:03

Is not that behavior, and a solution, described by the following section of the 'mount' man page?
Note that [when the --bind option is used] the filesystem mount options will remain the same as those on the original mount point, and cannot be changed by passing the -o option along with --bind/--rbind. The mount options can be changed by a separate remount command, for example:
Code: Select all
                     mount --bind olddir newdir
                     mount -o remount,ro newdir
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian Kernighan
User avatar
saulgoode
 
Posts: 1545
Joined: 2007-10-22 11:34

Re: fstab ignoring uid attribute when binding

Postby javiribera » 2013-01-30 17:35

Ups, thank you.

But anyway it doesn't work for me...

I mean now with
Code: Select all
/root/folderSource /root/folderTarget none      defaults,bind 0 0

in fstab,

mount -o remount,uid=1001,gid=1002 folderTarget doesn't change the owner:
Code: Select all
root@raspberrypi:~# tree
.
├── folderSource
│   └── file
└── folderTarget

2 directories, 1 file
root@raspberrypi:~# ls -l folderSource/
total 0
-rw-r--r-- 1 root root 0 ene 30 17:56 file
root@raspberrypi:~# mount -a
root@raspberrypi:~# tree
.
├── folderSource
│   └── file
└── folderTarget
    └── file

2 directories, 2 files
root@raspberrypi:~# ls -l folderTarget/
total 0
-rw-r--r-- 1 root root 0 ene 30 17:56 file
root@raspberrypi:~# mount -o remount,uid=1001,gid=1002 folderTarget
root@raspberrypi:~# ls -l folderTarget/
total 0
-rw-r--r-- 1 root root 0 ene 30 17:56 file
root@raspberrypi:~#
User avatar
javiribera
 
Posts: 8
Joined: 2012-08-27 10:47

Re: fstab ignoring uid attribute when binding

Postby saulgoode » 2013-01-31 09:34

Perhaps the problem is that 'ls' is showing the real IDs and not the effective IDs. If you look in /etc/mtab then you should see the effective uid/gid .

If such is the case, I'd recommend carrying on with whatever you were attempting to do and see if it works.
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian Kernighan
User avatar
saulgoode
 
Posts: 1545
Joined: 2007-10-22 11:34

Re: fstab ignoring uid attribute when binding

Postby javiribera » 2013-01-31 09:56

saulgoode wrote:Perhaps the problem is that 'ls' is showing the real IDs and not the effective IDs. If you look in /etc/mtab then you should see the effective uid/gid .

If such is the case, I'd recommend carrying on with whatever you were attempting to do and see if it works.


I've just tried to modify the file or create another one from the user suposed to have been done privileges (1001), but doesn't work... :S
User avatar
javiribera
 
Posts: 8
Joined: 2012-08-27 10:47


Return to System configuration

Who is online

Users browsing this forum: No registered users and 9 guests

fashionable