Here is what I did:
-Create an image file
-put a filesystem on it, ext4
-mount it to a mount point directory using a loop device
-then cd into the mount point
-touch a file, text.txt <<=== I was denied permission to touch a file.
But when I looked at the ownership permission at mount point, mntpoint, the current user can do rwx.
Below are the sequential command line operations:
Quote:
user1@localhost ~/lflab $ ls
user1@localhost ~/lflab $ dd if=/dev/zero of=imagefile bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 7.06019 s, 152 MB/s
user1@localhost ~/lflab $ ls -alh
total 1.1G
drwxr-xr-x 2 user1 user1 4.0K Apr 14 14:32 .
drwxr-xr-x 103 user1 user1 4.0K Apr 14 14:07 ..
-rw-r--r-- 1 user1 user1 1.0G Apr 14 14:32 imagefile
user1@localhost ~/lflab $ mkfs.ext4 imagefile
mke2fs 1.42.9 (4-Feb-2014)
imagefile is not a block special device.
Proceed anyway? (y,n) y
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
user1@localhost ~/lflab $ mkdir mntpoint
user1@localhost ~/lflab $ ls -alh
total 33M
drwxr-xr-x 3 user1 user1 4.0K Apr 14 14:37 .
drwxr-xr-x 103 user1 user1 4.0K Apr 14 14:07 ..
-rw-r--r-- 1 user1 user1 1.0G Apr 14 14:35 imagefile
drwxr-xr-x 2 user1 user1 4.0K Apr 14 14:37 mntpoint
user1@localhost ~/lflab $ cd mntpoint/
user1@localhost ~/lflab/mntpoint $ ls
user1@localhost ~/lflab/mntpoint $ cd ..
user1@localhost ~/lflab $ sudo mount -o loop imagefile mntpoint/
user1@localhost ~/lflab $ cd mntpoint/
user1@localhost ~/lflab/mntpoint $ ls
lost+found
user1@localhost ~/lflab/mntpoint $ ls -alh
total 24K
drwxr-xr-x 3 root root 4.0K Apr 14 14:35 .
drwxr-xr-x 3 user1 user1 4.0K Apr 14 14:37 ..
drwx------ 2 root root 16K Apr 14 14:35 lost+found
user1@localhost ~/lflab/mntpoint $ touch text.txt
touch: cannot touch ‘text.txt’: Permission denied
user1@localhost ~/lflab/mntpoint $ cd ..
user1@localhost ~/lflab $ ls -alh
total 33M
drwxr-xr-x 3 user1 user1 4.0K Apr 14 14:37 .
drwxr-xr-x 103 user1 user1 4.0K Apr 14 14:07 ..
-rw-r--r-- 1 user1 user1 1.0G Apr 14 14:40 imagefile
drwxr-xr-x 3 root root 4.0K Apr 14 14:35 mntpoint
user1@localhost ~/lflab $
|
Please advice?
Thank you.