LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Formatting hard drive with ext3/ext4 while getting full rwx permissions (http://www.linuxquestions.org/questions/linux-newbie-8/formatting-hard-drive-with-ext3-ext4-while-getting-full-rwx-permissions-778623/)

PasBern 12-29-2009 02:38 AM

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

evo2 12-29-2009 02:45 AM

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.

ongte 12-29-2009 03:48 AM

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

AlucardZero 12-29-2009 08:25 AM

Use chmod and/or chown.

onebuck 12-29-2009 09:43 AM

Hi,

Welcome to LQ!

Quote:

Originally Posted by PasBern (Post 3807517)
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
:hattip:
The above links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!

PasBern 12-30-2009 03:13 AM

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?

onebuck 12-30-2009 05:29 AM

HI,

Quote:

Originally Posted by PasBern (Post 3808601)
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.

:hattip:

PasBern 12-30-2009 08:29 AM

Quote:

Originally Posted by onebuck (Post 3808683)
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.

:hattip:

@ 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.

onebuck 12-30-2009 09:35 AM

Hi,

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

:hattip:

kilgoretrout 12-30-2009 09:55 AM

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>

PasBern 12-30-2009 01:16 PM

@ 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.


All times are GMT -5. The time now is 03:52 PM.