LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 12-29-2009, 01:38 AM   #1
PasBern
Member
 
Registered: Dec 2009
Location: Near Frankfurt, Germany
Distribution: OpenSUSE Leap 15.5, MacOS
Posts: 122

Rep: Reputation: 2
Formatting hard drive with ext3/ext4 while getting full rwx permissions


Hey all,

I couldn't find a similar thread about this topic, maybe didn't search long enough, so forgive me for cross-posting and if this is the case, post a relevant link.
How can I format a USB hard drive to ext3/ext4 or whatever file format and have full permission to read, write and execute all files afterwards? When using the command line (as ROOT of course) mkfs.ext3 /dev/sdb??? restricts the rights to ROOT as does the procedure gParted. The man mkfs did not help much.
Configuring the fstab- file is a bit of a hassle, so it would be nice, if there was an option to set the permissions "correctly" right from the beginning. Setting Ubuntu (I'm using Ubuntu 9.10) up, so that it mounts USB devices not as ROOT as default but giving all users all permissions seems to be really complicated, as a guy from my local LUG told me.

Thanks for your help
 
Old 12-29-2009, 01:45 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
The permissions are set at mount time. The mount man page has a huge amount of information. How are you mounting the partition? What is the entry in your fstab?

Evo2.
 
Old 12-29-2009, 02:48 AM   #3
ongte
Member
 
Registered: Jun 2009
Location: Penang, Malaysia
Distribution: Mageia, CentOS, Ubuntu
Posts: 468

Rep: Reputation: 72
Try chown on the mount point. Change the owner to you.

Say the disk is mounted at /media/disk and your username is pasbern.
Code:
$ sudo chown pasbern.pasbern /media/disk
 
Old 12-29-2009, 07:25 AM   #4
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Use chmod and/or chown.
 
Old 12-29-2009, 08:43 AM   #5
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

Welcome to LQ!

Quote:
Originally Posted by PasBern View Post
Hey all,

I couldn't find a similar thread about this topic, maybe didn't search long enough, so forgive me for cross-posting and if this is the case, post a relevant link.
How can I format a USB hard drive to ext3/ext4 or whatever file format and have full permission to read, write and execute all files afterwards? When using the command line (as ROOT of course) mkfs.ext3 /dev/sdb??? restricts the rights to ROOT as does the procedure gParted. The man mkfs did not help much.
Configuring the fstab- file is a bit of a hassle, so it would be nice, if there was an option to set the permissions "correctly" right from the beginning. Setting Ubuntu (I'm using Ubuntu 9.10) up, so that it mounts USB devices not as ROOT as default but giving all users all permissions seems to be really complicated, as a guy from my local LUG told me.

Thanks for your help
You can create the filesystem via the front end 'mkfs';

Quote:
excerpt 'man mkfs';

mkfs - build a Linux file system
SYNOPSIS
mkfs [ -V ] [ -t fstype ] [ fs-options ] filesys [ blocks ]
DESCRIPTION
mkfs is used to build a Linux file system on a device, usually a hard disk partition. filesys is either the device name (e.g. /dev/hda1, /dev/sdb2) or the mount point (e.g. /, /usr, /home) for the file system. blocks is the number of blocks to be used for the file system.

The exit code returned by mkfs is 0 on success and 1 on failure.

In actuality, mkfs is simply a front-end for the various file system builders (mkfs.fstype) available under Linux. The file system-specific builder is searched for in a number of directories like perhaps /sbin, /sbin/fs, /sbin/fs.d, /etc/fs, /etc (the precise list is defined at compile time but at least contains /sbin and /sbin/fs), and finally in the directories listed in the PATH enviroment variable. Please see the file system-specific builder manual pages for further details.
If you look at the 'man chmod' & 'man chown' to understand the option of each you should then be able to select the means to suit the needs. If you want to mount via 'fstab' then be sure to look at 'man fstab'.


Just a few links to aid you to understand;

Linux Documentation Project
Rute Tutorial & Exposition
Linux Command Guide
Utimate Linux Newbie Guide
LinuxSelfHelp
Getting Started with Linux
Advanced Bash-Scripting Guide

The above links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!
 
Old 12-30-2009, 02:13 AM   #6
PasBern
Member
 
Registered: Dec 2009
Location: Near Frankfurt, Germany
Distribution: OpenSUSE Leap 15.5, MacOS
Posts: 122

Original Poster
Rep: Reputation: 2
Thanks a lot for your quick answers. The command chown seems to work even on remount. Couldn't get to work with a vfat file system earlier, since the file system was corrupted, so at that time I figured the thing is not so useful after all. I will have a closer look at the man pages of chown & chmod.
By the way, is there an easy way to configure Ubuntu, so that USB-devices get mounted with all users having all permissions?
 
Old 12-30-2009, 04:29 AM   #7
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
HI,

Quote:
Originally Posted by PasBern View Post
Thanks a lot for your quick answers. The command chown seems to work even on remount. Couldn't get to work with a vfat file system earlier, since the file system was corrupted, so at that time I figured the thing is not so useful after all. I will have a closer look at the man pages of chown & chmod.
By the way, is there an easy way to configure Ubuntu, so that USB-devices get mounted with all users having all permissions?
Not a wise thing to do with a 'vfat' filesystem. I suggest that you read for understanding some of the reference links that I provided earlier.

 
Old 12-30-2009, 07:29 AM   #8
PasBern
Member
 
Registered: Dec 2009
Location: Near Frankfurt, Germany
Distribution: OpenSUSE Leap 15.5, MacOS
Posts: 122

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by onebuck View Post
HI,



Not a wise thing to do with a 'vfat' filesystem. I suggest that you read for understanding some of the reference links that I provided earlier.

@ onebuck:
Do you mean setting the mount options for 'vfat' filesystem with rwx permission for all users, by "not a wise thing"?
Well, I have formatted the hard drive with ntfs, so it can still be used with my Windows partition. Thinking about installing an ext3-plugin for Windows.
 
Old 12-30-2009, 08:35 AM   #9
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

Mounting of the filesystem permissions is different than permissions of the files on a vfat filesystem.

 
Old 12-30-2009, 08:55 AM   #10
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,987

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
You seem to be confused about the way linux handles various filesystems.

For starters, FAT32 and FAT16 don't have a native permission structure per se so linux grafts one on it in order to make vfat compatible with linux. With vfat, you change access permissions by changing the "umask" option in the fstab entry for the vfat partition. You can't use chmod or chown on a vfat filesystem since it has no native permission structure, only an emaulated one created by the linux kernel for compatibility reasons. If you try to chmod or chown a vfat filesystem, even as root you will get a permission denied error message.

Native linux filesystems like ext3, ext4, reiserfs, xfs, etc, have native support for linux file permissions built into the filesystem. You change the permissions on a partition with a linux filesystem by running chmod or chown on the partition mount point while the partition is mounted. It will not work if you run those commands while the partition is not mounted. For example, if you wnat to give everyone rwx permissions on an external hard drive, you would mount the external hard drive partition and run as root:

# chmod -R 777 <external hard drive mount point>
 
1 members found this post helpful.
Old 12-30-2009, 12:16 PM   #11
PasBern
Member
 
Registered: Dec 2009
Location: Near Frankfurt, Germany
Distribution: OpenSUSE Leap 15.5, MacOS
Posts: 122

Original Poster
Rep: Reputation: 2
Smile

@ kilgoretrout
You started a real enlightenment process regarding my understanding of file systems. I knew that FAT doesn't have a permission structure and that with Linux it gets a little more complicated than with Windows. Now, I understand why I had problems with vfat. Well, everything is working by now (for the moment at least) and I will have a look into the umask options. By the way I once did # chmod a+rwx -R /etc which wasn't such a good thing to do after all (wanted to get execute permission on a file for installing an running a package). So I after total reinstall of Ubuntu I tried to keep a bit off that command.

To all members,
thanx a lot your helpful and friendly advice.

Last edited by PasBern; 12-30-2009 at 12:19 PM. Reason: spelling errors
 
  


Reply

Tags
file, system



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
Convert ext4 FS to ext3 without formatting HDD n03x3c Linux - General 3 12-04-2009 05:47 AM
Formatting drive to ext4 simonb1975uk Slackware 2 01-08-2009 11:10 AM
I'm formatting my TB Drive into ext3 Jon N. Linux - Newbie 5 12-12-2008 06:46 AM
Enabling rwx permissions on my removable USB hard disk? mejpark SUSE / openSUSE 11 10-10-2006 01:08 PM
r/w permissions on a mounted ext3 hard drive harperonline Linux - Hardware 1 03-19-2003 05:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:42 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