LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to create an ext2 partition from command line which is writable from every user (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-create-an-ext2-partition-from-command-line-which-is-writable-from-every-user-766603/)

piefa703 11-03-2009 05:57 PM

how to create an ext2 partition from command line which is writable from every user
 
Hi,

I work with a Debian Squeeze on my laptop and I have a 160GB external hard disk. My hard disk was formatted FAT32, but I decided to format it using ext2.

I formatted it using fdisk from command line and everything went well. Unfortunately, when I mount my hard drive(which is auto-mounted from Debian) it has got root both as owner and group. Then I can't write to it because I have no permission to do that.

Is there a setting to create an ext2 partition which has as owner the logged system user in order to have right permission every time.

I hope you have a solution!

pixellany 11-03-2009 06:05 PM

welcome to LQ!!

We have many solutions!!!---possibly more than you want....;)

First, there are three distinct steps:
1. Create the partition
2. Format it with a filesystem
3. Mount it to the system tree

To create: fdisk, cfdisk, GParted, and many more (these tools typically do not do formatting.)

To format: mkfs (eg: mkfs.ext3 or mkfs.msdos)

To mount: (create a mount point, and then) mount

To mount automatically: edit /etc/fstab

Normally, to set permissions, you would set them for the mount point. I think you can do this before or after mounting, but I have not played with this for a while.

cantab 11-03-2009 06:05 PM

Erm...you just change the permissions on the drive.
Code:

chmod ugo+rwX /media/drive
will let any user write to the drive. EDIT: You do this when the drive is mounted, and as root. Permissions on the mountpoint directory when the drive is not mounted have no effect once it is mounted.

tananthulus 11-03-2009 06:12 PM

Quote:

Originally Posted by cantab (Post 3743275)
Erm...you just change the permissions on the drive.
Code:

chmod ugo+rwX /media/drive
will let any user write to the drive. EDIT: You do this when the drive is mounted, and as root. Permissions on the mountpoint directory when the drive is not mounted have no effect once it is mounted.

Sweet my friend you have answered my question as well!

piefa703 11-03-2009 06:32 PM

Thanks for your well-timed answers!

Perhaps I bad explained my point. If a create a mount point and after I mount the hard drive to that mount point I have the root permission yet.
However, if I change the owner to user1 (for instance) on my hard disk, I could read and write everything. Unfortunately, if I connect my hard drive to a different laptop which has user2 as logged user, I can't write on the hard disk because of I haven't permission as well!!!
Is there any settings to say "each time the system auto-mount the hard drive has to assign the logged user as hard disk owner"?

How could I fix that???

Thanks

evo2 11-03-2009 07:49 PM

How are you doing the mounting? Do you have an entry in your fstab? I achieve what you seem to be describing with an fstab entry like:

/dev/foo /media/foo auto defaults,user,noauto 0 0

Then, the user can just type 'mount /media/foo'

Evo2.

cantab 11-04-2009 07:03 AM

Quote:

Originally Posted by piefa703 (Post 3743327)
Thanks for your well-timed answers!

Perhaps I bad explained my point. If a create a mount point and after I mount the hard drive to that mount point I have the root permission yet.
However, if I change the owner to user1 (for instance) on my hard disk, I could read and write everything. Unfortunately, if I connect my hard drive to a different laptop which has user2 as logged user, I can't write on the hard disk because of I haven't permission as well!!!
Is there any settings to say "each time the system auto-mount the hard drive has to assign the logged user as hard disk owner"?

How could I fix that???

Thanks

You probably CAN do what you're describing, but I'm not sure why you need to. For an ext2 drive - or any other Linux format - you can simply set the permissions on the DRIVE so that anyone can write to it, regardless of who the owner is. Those permissions remain whatever Linux system you connect the drive to.

piefa703 11-04-2009 11:07 AM

Hi,

I finished to give all permission to my hard hard drive as cantab said. In that way every user has got permission on what it creates, that's fine for me.

Thanks to everyone!


All times are GMT -5. The time now is 12:14 AM.