change owner/uid of mount point upon mount
Posted
by
Shiplu
on Super User
See other posts from Super User
or by Shiplu
Published on 2012-09-20T04:46:22Z
Indexed on
2012/11/30
17:08 UTC
Read the original article
Hit count: 332
The scenario is like this. Bob has a computer. It crashed. Now he only has the hdd. The hdd is in ext3 format. He go to his office and told the sys admin John to mount this hdd and put the mount point in his home directory. John used the following fstab entries.
# Bobs harddisk
/media/TAPE4/Bobs-hdd.img /home/bob/myhdd/windows ntfs ro,loop,offset=32256 0 0
/media/TAPE4/Bobs-hdd.img /home/bob/myhdd/linux ext3 ro,loop,offset=14048810496 0 0
/media/TAPE4/Bobs-hdd.img /home/bob/myhdd/extra ntfs ro,loop,offset=28015335936 0 0
Bob was happy. He could access his old extra
and windows
. Specially the Documents and Settings
in windows
was helpful for him.
But he found a problem. He is a web developer and all his websites are in linux/home/bob/public_html
directory. When he tried to access that public_html
directory he got permission_denied
. He executed ls -lh
he saw this.
drwxr-xr-x 2 john john 4.0K Nov 9 2011 Desktop
drwxr-xr-x 3 john john 4.0K Aug 12 2011 Documents
drwxr-xr-x 3 john john 4.0K Aug 21 2011 public_html
He contacted John thinking he might be mistakenly did this. But John couldn't find a way why this happend? Then one thing came into his mind file system hardly store username. They store uids. So he executed ls -ln
drwxr-xr-x 2 1000 1000 4096 Nov 9 2011 Desktop
drwxr-xr-x 3 1000 1000 4096 Aug 12 2011 Documents
drwxr-xr-x 3 1000 1000 4096 Aug 21 2011 public_html
John thinks 1000 is the first uid on a linux system. As he is the admin of the current system. He created his account first. so Johns uid was 1000
. Bob also setup his private system and crated his account first. So Bobs uid was 1000
too.
So thats an expected behavior. But problem remains. How can Bob access those websites in public_html
?
© Super User or respective owner