LinuxQuestions.org
Have you listened to LQ Radio?
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This 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

Tags used in this thread
Popular LQ Tags , , , ,

Reply
 
Thread Tools
Old 11-03-2009, 05:57 PM   #1
piefa703
LQ Newbie
 
Registered: Nov 2009
Location: Sheffield
Distribution: Debian
Posts: 3
Thanked: 0
how to create an ext2 partition from command line which is writable from every user


[Log in to get rid of this advertisement]
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!
linuxdebian piefa703 is offline  
Tag This Post , , , ,
Reply With Quote
Old 11-03-2009, 06:05 PM   #2
pixellany
Moderator
 
Registered: Nov 2005
Location: Pasadena, CA
Distribution: Arch
Posts: 13,173
Thanked: 285
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.
linux pixellany is offline     Reply With Quote


Old 11-03-2009, 06:05 PM   #3
cantab
Member
 
Registered: Oct 2009
Distribution: Arch, Vector
Posts: 83
Thanked: 14
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 06:06 PM..
linux cantab is offline     Reply With Quote


Old 11-03-2009, 06:12 PM   #4
tananthulus
LQ Newbie
 
Registered: Nov 2009
Distribution: SuSE, CentOS, RedHat, Solaris, Debian, Ubuntu, Fedora
Posts: 17
Thanked: 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!
linuxubuntu tananthulus is offline     Reply With Quote


Old 11-03-2009, 06:32 PM   #5
piefa703
LQ Newbie
 
Registered: Nov 2009
Location: Sheffield
Distribution: Debian
Posts: 3
Thanked: 0

Original Poster
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
linuxdebian piefa703 is offline     Reply With Quote


Old 11-03-2009, 07:49 PM   #6
evo2
Member
 
Registered: Jan 2009
Location: Japan
Distribution: Debian
Posts: 219
Thanked: 28
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.
linuxdebian evo2 is offline     Reply With Quote


Old 11-04-2009, 07:03 AM   #7
cantab
Member
 
Registered: Oct 2009
Distribution: Arch, Vector
Posts: 83
Thanked: 14
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.
linux cantab is offline     Reply With Quote


Old 11-04-2009, 11:07 AM   #8
piefa703
LQ Newbie
 
Registered: Nov 2009
Location: Sheffield
Distribution: Debian
Posts: 3
Thanked: 0

Original Poster
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!
linuxdebian piefa703 is offline     Reply With Quote



Reply

Bookmarks


Thread Tools

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
[SOLVED] Gain access to ext2 partition without ext2 support in kernel ColInvictus Gentoo 3 10-26-2009 07:57 AM
Terminal commands: how to create a directory in ext2 partition on flash drive gordon__1 Linux - Newbie 6 01-14-2008 11:57 PM
cannot create 1MB ext2 partition on HDD fitzov Linux - General 5 05-18-2007 06:04 PM
Mounting Hard drive partition as writable with -rw swich using mount command fultron Linux - Newbie 4 02-13-2007 01:47 PM
How do you create a user account from command line??? bossdog22 Ubuntu 3 04-18-2006 02:06 PM


All times are GMT -5. The time now is 11:29 PM.

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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration