LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 11-03-2009, 04:57 PM   #1
piefa703
LQ Newbie
 
Registered: Nov 2009
Location: Sheffield
Distribution: Debian
Posts: 3

Rep: Reputation: 0
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!
 
Old 11-03-2009, 05:05 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
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.
 
Old 11-03-2009, 05:05 PM   #3
cantab
Member
 
Registered: Oct 2009
Location: England
Distribution: *buntu, Vector
Posts: 499

Rep: Reputation: 102Reputation: 102
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.

Last edited by cantab; 11-03-2009 at 05:06 PM.
 
Old 11-03-2009, 05:12 PM   #4
tananthulus
LQ Newbie
 
Registered: Nov 2009
Distribution: SuSE, CentOS, RedHat, Solaris, Debian, Ubuntu, Fedora
Posts: 17

Rep: Reputation: 0
Quote:
Originally Posted by cantab View Post
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!
 
Old 11-03-2009, 05:32 PM   #5
piefa703
LQ Newbie
 
Registered: Nov 2009
Location: Sheffield
Distribution: Debian
Posts: 3

Original Poster
Rep: Reputation: 0
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
 
Old 11-03-2009, 06:49 PM   #6
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Debian, SL
Posts: 5,110

Rep: Reputation: 1102Reputation: 1102Reputation: 1102Reputation: 1102Reputation: 1102Reputation: 1102Reputation: 1102Reputation: 1102Reputation: 1102
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.
 
Old 11-04-2009, 06:03 AM   #7
cantab
Member
 
Registered: Oct 2009
Location: England
Distribution: *buntu, Vector
Posts: 499

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by piefa703 View Post
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.
 
Old 11-04-2009, 10:07 AM   #8
piefa703
LQ Newbie
 
Registered: Nov 2009
Location: Sheffield
Distribution: Debian
Posts: 3

Original Poster
Rep: Reputation: 0
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!
 
  


Reply

Tags
debian, ext2, fdisk, partition, permission


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mounting Hard drive partition as writable with -rw swich using mount command fultron Linux - Newbie 12 08-16-2013 06:56 AM
[SOLVED] Gain access to ext2 partition without ext2 support in kernel ColInvictus Gentoo 3 10-26-2009 06:57 AM
Terminal commands: how to create a directory in ext2 partition on flash drive gordon__1 Linux - Newbie 6 01-14-2008 10:57 PM
cannot create 1MB ext2 partition on HDD fitzov Linux - General 5 05-18-2007 05:04 PM
How do you create a user account from command line??? bossdog22 Ubuntu 3 04-18-2006 01:06 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration