LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   File System permissions (https://www.linuxquestions.org/questions/linux-newbie-8/file-system-permissions-657935/)

Virtual Circuit 07-24-2008 06:48 AM

File System permissions
 
I spent a hour trying to save a file from the web. I kept getting permission errors. So I opened a console window as root. I tried to change permissions with 'chmod' to a+rwx' ; no warning or error messages and the write (w) permission to group(g) and all(a) were not affected. The user and group were 'root', so I decided to change that too. Again no success.
Then it occurred to me that the entire partion might be write protected. so I looked at my
Code:

root@VirtualCircuit:~# cat /etc/fstab
/dev/sda8        swap            swap        defaults        0  0
/dev/sda6        /                ext3        defaults        1  1
/dev/sda5        /mnt/win        vfat        defaults        1  0
#/dev/cdrom      /mnt/cdrom      auto        noauto,owner,ro  0  0
/dev/fd0        /mnt/floppy      auto        noauto,owner    0  0
devpts          /dev/pts        devpts      gid=5,mode=620  0  0
proc            /proc            proc        defaults        0  0
root@VirtualCircuit:~#

note /mnt/win is the problem. i checked the man for fstab and the slack book, they says to use 'defauts' not ro, and that is how it is setup, so why is this not working.

By the way, I logged out of KDE and back in as root, and no problemo.

David the H. 07-24-2008 07:26 AM

The FAT filesystem cannot support *nix-style permissions, so no amount of chmodding or chowning will ever do you any good on a FAT partition. The permissions must be simulated at mount time, and can be changed with the umask, uid, and gid mount options.

When you use "defaults", the permissions and ownership are set for root, which is why it works when you are logged in as root. So instead of using "defaults", set uid=username, gid=groupname, and umask to equal the inverse of the permissions you want (e.g. umask=000 gives the drive full 777 permissions).

Virtual Circuit 07-25-2008 03:11 AM

/etc/fstab
 
I've read a few similar posts, I just have 2 more questions.
(1) why can't I change some permissions and not others on vfat?
(2) please tell me how to modify my fstab file?

Quote:

You can't use the 'chmod' command on a mounted vfat partition. You need to use the umask= option instead. As an alternative, you can use the fmask= and dmask= options to give different permissions for files and directories. You probably don't want files on this drive to be executable, so you could mask out the 'x' execution bit using fmask. However, the 'x' bit serves a different function for directories, so you would want it set.

Read through the 'man mount' man-page for all of the gory details!

There are other options you can use. For example, instead of the users option you can use 'uid=' and 'gid=' option. So if your username is 'guy24x' you could have 'uid=guy24x' as one of the options. This will make you the owner of the partition, and give you full access. If there is a 'guy24x' group also, you could use 'gid=guy24x'.

so I replace 'defaults' with 'umask 000'

FranDango 07-25-2008 06:33 AM

(1) Windows VFAT file systems have different attributes stored for files. No UNIX-style users and groups, though it is possible to make a distinction between read-only and write-enabled.

(2) You can modify the fstab file with any editor that you like, but you must have root privileges to do that. Other than that, your settings for /mnt/win are OK - the problem has nothing to do with mounting, but with the the mounted filesystem.

Linux Archive

IsharaComix 11-18-2008 09:33 AM

So this is why...
 
Sorry to revive an old post like this, but I've got a couple of related questions:

1.) Does NTFS not support Unix-style permissions either (just out of curiosity)?

2.) When I extract files from a tar archive, the file permissions are preserved, even when the tar is saved on another file system. Would this hold true in all cases?

i92guboj 11-18-2008 10:25 AM

Quote:

Originally Posted by IsharaComix (Post 3346348)
Sorry to revive an old post like this, but I've got a couple of related questions:

1.) Does NTFS not support Unix-style permissions either (just out of curiosity)?

At low levels, linux file systems and ntfs has nothing to do with each other, and there's no exact match for everything. However, at driver level it's possible to approximate the behavior of both to a certain degree. How deep that approximation goes is something that I never bothered to research. It ultimately depends on the driver. If you use ntfs-3g you might find this useful:

http://pagesperso-orange.fr/b.andre/permissions.html

If you use the in-kernel driver you don't have to bother because the write support is "limited" (non-existant if you ask me). Still anything that you need to know should be described on the relevant docs under the Documents subdirectory in your kernel source dir.

Quote:

2.) When I extract files from a tar archive, the file permissions are preserved, even when the tar is saved on another file system. Would this hold true in all cases?
Permissions are stored inside the tarball when you create it. Whether these will be restored when uncompressing depend on two things: the usage (or not) of -p (preserve) and the support of the file system (or better said, the implementation of your concrete driver) to do something useful with that metainfo.

If your fs driver doesn't understand the permissions, then they are ignored.


All times are GMT -5. The time now is 06:42 PM.