LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-21-2006, 11:07 PM   #1
locke_as16
LQ Newbie
 
Registered: Mar 2006
Distribution: SuSE 10.0
Posts: 11

Rep: Reputation: 0
help to modify the permissions for a partition


I need some help to modify the permissions of a partition and my distirbution is suse 10.0.

I've created a FAT32 partition but only as root I can modify the contents and I donīt know how to change the permissions of the partition so I can modify the contents as a normal user.

Any help is apreciated!!
 
Old 04-21-2006, 11:10 PM   #2
Poetics
Senior Member
 
Registered: Jun 2003
Location: California
Distribution: Slackware
Posts: 1,181

Rep: Reputation: 49
Once you've mounted the drive, the partitions are all a function of the directory structure. If it's empty (meaning only the root ("/") directory exists), and only root has RWX access, I'd suggest creating a directory and using "chown" or "chmod" to make it so another user can modify its contents, then start reading, writing, and executing files as you will!

(an example follows)
Code:
# ls
. ..
# mkdir grabbag
# chown username grabbag/
# ls
. .. grabbag
#
 
Old 04-22-2006, 12:25 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
The Fat32 filesystem does not contain linux permissions, so you can't use the chmod command. You need to set the user, group and permissions in the /etc/fstab file.

Use the umask option to allow all users full access. "umask=000" for example.
To mount the partition giving user "locke" exclusive access use the "uid=locke" option with "umask=077"

To demonstrate, let's create a 1/2 Mb file and create a vfat file system on it:
> dd if=/dev/zero of=testfile count=1024 bs=512
> /sbin/mkfs.vfat testfile

Now let's create a place to mount it:
mkdir testdir

Mounting it with umask=000 option:
sudo mount -t vfat testfile testdir/ -o loop,umask=000

mount | grep testdir
/home/username/testfile on /home/username/testdir type vfat (rw,loop=/dev/loop5,umask=000)
ls -ld testdir/
drwxrwxrwx 2 root root 16384 1969-12-31 17:00 testdir/

Notice that user, group and other have full access.

sudo umount testdir
:~> sudo mount -t vfat testfile testdir/ -o loop,uid=jschiwal,gid=jschiwal,umask=007
:~> ls -ld testdir
drwxrwx--- 2 jschiwal jschiwal 16384 1969-12-31 17:00 testdir

:~> sudo touch testdir/file
:~> ls -l testdir/file
-rwxrwx--- 1 jschiwal jschiwal 0 2006-04-22 00:20 testdir/file

Notice that even though root created the testdir/file, that the permissions of the file are inherited from the way the drive was mounted.

You can also use separate fmask and dmask options instead of umask. They allow separate permissions for files and directories. This allows you to use rw- permissions for files and rwx permissions on directories. The "x" permission bit on directories allows someone to enter that directory.

:~> sudo umount testdir
:~> sudo mount -t vfat testfile testdir/ -o loop,fmask=111,dmask=000
:~> mkdir testdir/subdir
:~> touch testdir/subdir/second_file
:~> ls -lR testdir
testdir:
total 2
-rw-rw-rw- 1 root root 0 2006-04-22 00:20 file
-rw-rw-rw- 1 root root 0 2006-04-22 00:19 sample
drwxrwxrwx 2 root root 2048 2006-04-22 00:23 subdir

testdir/subdir:
total 0
-rw-rw-rw- 1 root root 0 2006-04-22 00:23 second_file

I didn't have a vfat filesystem handy, to test this so I created a fat32 (vfat) filesystem on a file instead. In your case, don't use the option "loop".

-----------

If your system uses the udev daemon, I think you can allow access to a usb vfat drive by making yourself a member of the "disk" group.
from /etc/udev/rules.d/50-udev.rules
KERNEL=="sg*", NAME="%k", GROUP="disk", MODE="660"
I'm not absolutely certain of this, and whether this is the purpose of the "disk" group.

Last edited by jschiwal; 04-22-2006 at 12:46 AM.
 
Old 04-22-2006, 02:03 AM   #4
locke_as16
LQ Newbie
 
Registered: Mar 2006
Distribution: SuSE 10.0
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks!!

Thanks a lot, editing the fstab file with the option umask=000 worked great and now I can modify the contents of the FAT32 partition as a normal user
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot modify permissions of Windows XP directories refp16 Linux - Networking 2 10-22-2005 11:14 AM
Modify first partition CowboyJ Linux - Hardware 2 05-30-2005 10:57 PM
Is there a way to modify/edit/erase a file in a WinXP partition from within Linux? aixarat Linux - Newbie 8 09-25-2004 11:07 PM
cant modify a file on mounted FAT partition dwarf007 Linux - Newbie 7 09-24-2004 08:02 AM
unable to modify files on FAT32 partition thegreatgatsby Linux - Hardware 4 05-28-2004 03:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration