Quote:
Originally Posted by agarwaldvk
from what I had read and interpreted, I believed these changes are only live until the current session and die out on reboot.
|
When you make a change with chown or chmod the changes will persist - except in the case of a live session (live DVD or USB).
Changes are not preserved in that case. (Depending on exactly WHAT you changed...)
Quote:
Originally Posted by hazel
Yes, they are permanent. The ownership and permissions of a file are stored in the file's inode. They are permanent properties of the file, just like the file type or the creation date. It's worth pointing out that ownership is stored as the UID number, not the name. Software such as ls translates it into a name for display.
|
...another very accurate and well-said post by hazel.
I would like to throw a wrench into the gears, with the only example where that does not APPEAR to hold true.
EXAMPLE: Create a partition with an ext filesystem (either on a hard drive or USB drive). When I connect my USB drive, /dev/sdc, which has one ext partition, it is mounted at /media/dan/8GBPatriot
I enter the command:
Code:
sudo chown -R dan:dan /media/dan/8GBPatriot/
Then I create a mount point with the command:
Code:
sudo mkdir /mnt/DATA
Obviously, the DATA directory I created is owned by root...
dan@skynet1 ~ $ ls -la /mnt
total 12K
drwxrwxrwt 3 dan dan 4.0K Nov 13 04:46 ./
drwxr-xr-x 25 root root 4.0K Nov 11 22:04 ../
drwxr-xr-x 2 root root 4.0K Nov 13 04:46 DATA/
I then unmount my usb drive:
Code:
sudo umount /media/dan/8GBPatriot
and mount it at /mnt/DATA:
Code:
sudo mount /dev/sdc1 /mnt/DATA
The ownership of /mnt/DATA has magically changed from root to dan!
dan@skynet1 ~ $ ls -la /mnt
total 12
drwxrwxrwt 3 dan dan 4096 Nov 13 04:46 .
drwxr-xr-x 25 root root 4096 Nov 11 22:04 ..
drwxrwxrwt 5 dan dan 4096 Nov 11 22:06 DATA
The explanation for that is in the mechanics of the mount process. When you mount a partition to a directory, the properties of the directory are replaced by the properties (ownership and permissions) of the filesystem you mounted. When you unmount, the original properties return.
So the moral of the story is that ownership and permissions are permanent - except when they aren't...