Accessing partitions as user

Matt Graham danceswithcrows at usa.net
Fri Jul 6 07:20:31 MST 2007


On Thursday 05 July 2007 19:22, after a long battle with technology, 
Harold Michels wrote:
> I want to be able to access my extra hard drive partitions as [a] user 
> so I can back things up, or whatever else I want to [do].

Set the permissions on these partitions appropriately, then, so that the 
UID you usually use can do whatever you need to do to those files.

> I can store files on the mounted drive as [root] and then delete
> them. I dismounted the drives and then as [root] ran the following
> [command]

UID 0 is generally "root", not "superuser" or "su".

> # mount -t ext3 -o uid=501,gid=501 /dev/sda1

The uid= and gid= options are not valid for ext3.  Those options are 
there for filesystems that don't support UIDs and GIDs natively, like 
FAT or NTFS or CIFS.  "man mount" for more info than you ever wanted to 
know.  If you have media that may or may not be present and you want 
users to be able to mount them, you generally do this:

/dev/crud   /mnt/somewhere   auto   noauto,users   0   0

...in /etc/fstab .  Check out /dev/disk/by-label/ and /dev/disk/by-uuid/ 
for more robust ways of locating specific partitions on media that may 
move around.

> EXT3 FS on sda1, internal journal
> SELinux: initialized (dev sda1, type ext3), uses xattr

SELinux can be a total PITA.

> EXT3-fs: Unrecognized mount option "uid=501"

See above.

> 501 is the UID that is displayed in the Users and Group utility. I
> have been editing the file in the past and have changed my logon name
> and password as well as the group name.

?  ext3 stores UIDs and GIDs as numbers, and the system performs 
UID<->username translation based on /etc/passwd .  If you want to have 
ext3 on removable media (usually not a great idea), all systems where 
this media gets used need to have the same /etc/passwd , or stupid 
permissions problems will happen.

> Am I using a reasonable procedure for accessing the drives?

Removable media should usually be FAT32, ISO9660, or UDF, depending on 
whether they're disklike or CD-like.  (Maybe NTFS would work as well, 
since ntfs-3g seems to be fine now.)  If they're not in those formats, 
you'll have trouble using them on random machines.  FAT32 is lousy, but 
everything can read and write it.  If the media are only used on 
specific machines, you can get away with using less common 
filesystems... but then weird problems like the one you described can 
happen.

> Is it possible that I have corrupted something in Groups and Users?

I doubt that.  

-- 
   Seemingly ordinary humans transform into rage-fueled sarcasm
   dispensers.  I love it!  --Patrick Shaughnessy
There is no Darkness in Eternity/But only Light too dim for us to see


More information about the PLUG-discuss mailing list