Google
 

8/4/07

fstab and User permission.

User Permissions

To give read/write permission to everyone, add this phrase to the options for the file_system in your file /etc/fstab:

"gid=users,umask=000"

You need to have root access to edit that file. The whole line will look something like this:

/dev/hdxy   /mnt/hdxy  file_system  noatime,user,exec,dev,suid,gid=users,umask=000  0  0
  • x will be a letter starting with a, then b,c,....
  • y will be a number starting with 1, then 2,3,....

File types:

  • Linux file systems:
    • ext2, ext3, jfs, reiserfs, reiser4, xfs, swap.
  • Windows:
    • vfat = FAT 32, FAT 16
    • ntfs= NTFS

Additional Options: (From wiki.linuxquestions.org):

  • sync/async - All I/O to the file system should be done (a)synchronously.
  • auto - The filesystem can be mounted automatically (at bootup, or when mount is passed the -a option). This is really unnecessary as this is the default action of mount -a anyway.
  • noauto - The filesystem will NOT be automatically mounted at startup, or when mount passed -a. You must explicitly mount the filesystem.
  • dev/nodev - Permit any user to mount the filesystem. This automatically implies noexec
  • exec / noexec - Permit/Prevent the execution of binaries from the filesystem.
  • suid/nosuid - Permit/Block the operation of suid, and sgid bits.
  • ro - Mount read-only.
  • rw - Mount read-write.
  • user - Permit any user to mount the filesystem. This automatically implies noexec, nosuid,nodev unless overridden.
  • nouser - Only permit root to mount the filesystem. This is also a default setting.
  • defaults - Use default settings. Equivalent to rw, suid, dev, exec, auto, nouser, async.
  • _netdev - this is a network device, mount it after bringing up the network. Only valid with fstype nfs.

The "umask" is "user mask" and it sets the permission bits for permission that is not allowed if you wish to change the default.

VFAT/NTFS:

Syntax is "odd" at first.

  • To set a permissions of 777, umask=000
  • to set permissions of 700, umask=077
    • o= Sets owner. Syntax: must use owned by USER ID # not name.
    • g= sets group ownership of mount point. Again syntax is by GROUP ID # not name.

022 means everything is allowed for root, writing/executing are allowed for group and world.


Following is my /etc/fstab file.

# /etc/fstab: static file system information.
#
#
proc /proc proc defaults 0 0
/dev/sda6 / ext3 defaults,errors=remount-ro 0 1
/dev/sdb1 /backup ext3 rw,uid=1000,gid=1000 0 2
/dev/sda5 /data vfat rw,noatime,uid=1000,gid=1000,user 0 0
/dev/sda12 /home ext3 defaults 0 2
/dev/sda10 /tmp ext3 defaults 0 2
/dev/sda7 /usr ext3 defaults 0 2
/dev/sda8 /usr/local ext3 defaults 0 2
/dev/sda9 /var ext3 defaults 0 2
#/dev/sdb2 /win vfat rw,user,auto,umask=000 0 0
/dev/sdb2 /win vfat rw,user,auto,uid=1000,gid=1000 0 0
/dev/sda1 /windows vfat defaults 0 0
/dev/sda11 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0


1 comment:

Anonymous said...

i absolutely enjoy your own writing style, very helpful.
don't give up and also keep posting in all honesty , because it simply nicely to follow it.
looking forward to look at more and more of your content, enjoy your day ;)