LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-03-2005, 08:39 AM   #1
belliott4488
Member
 
Registered: Oct 2003
Location: Ellicott City, MD, US
Distribution: Fedora 11
Posts: 67

Rep: Reputation: 15
Question file system privileges between installations


I have recently installed Fedora Core 3 on my PC, which has been running Red Hat 9.0 for a year and a half or so. When I boot into Fedora, I can mount the Red Hat file system (it's on a separate drive, in case that matters), but unless I'm logged on as root, I am not given permission to see my old files on the Red Hat system. It appears that it doesn't recognize me as the same user (my username and password are the same, but that's not enough).

I examined my /etc/passwd files on each installation, and sure enough, the entry for my user id has different numbers, which I believe are for the group and user identification (?). (Ironically, Fedora coincidently assigned me the same numbers that had been assigned to my wife for her account on the Red Hat system, so I have complete access to her files!)

I tried simply editing the /etc/passwd file on the Fedora side so that the group and user numbers for my account match the ones on the Red Hat side, but that prevented me from being able to log in any more - I was denied permission to write a file (.gconf?) to my home directory, which was necessary for starting up something, probably a desktop manager. Apparently by changing the /etc/passwd entry I locked myself out of my account.

There must be a better way, can anyone help me? I think I just need to authenticate myself to the old file system so that it knows I'm me and will give me access to my old files.

thanks in advance,
Bruce
 
Old 03-03-2005, 09:22 AM   #2
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
As you have discovered, it's the uid that counts - not the username.
And different distro's assign different uid's per default to new users...
If you are lucky, the umask (what permissions are assigned per default) is set to 002, then both user and group has full access to files. If so just add the needed group to your system with same gid as on other system! Read on. Some distro's is more restrictive, so group can't access everything.
If this is the case for you, it is not very easily solved but it can be done.
Like this:
Logged in as user: pingu uid 501, group: pingu gid 501
Mounted system's user: shark uid 500, group: shark gid 500
Add a group shark to your system with gid 500!
Make yourself (pingu) member of that group.
Change permissions on mounted drive, so group has same permissions as user. This could be a bit tricky, on directories you need execute-permissions but you don't want that on every file.
One way is to add read+write-access to group shark recursively:
# chmod -R g+rw /home/shark
Then manually change permissions on the directories to executable for group.
Maybe someone, a bit better at writing scripts than me, can come up with an appropriate command?

To avoid this problem in the future:
1. Always create yoour users manually, assigning the uid and gid you want.
2. Set umask to 002.
 
Old 03-03-2005, 12:47 PM   #3
mikshaw
LQ Addict
 
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
You could change the uid of your FC3 user:
usermod -u <new UID> <username>

This will change the ownership of any files in the user's home directory to work with the new UID. It won't work if you already have a user with the desired UID, unless you use the -o option, but be warned: -o will overwrite the other user.
 
Old 03-03-2005, 04:13 PM   #4
belliott4488
Member
 
Registered: Oct 2003
Location: Ellicott City, MD, US
Distribution: Fedora 11
Posts: 67

Original Poster
Rep: Reputation: 15
Thanks, mikshaw - I didn't know about the usermod command. It sounds like exactly the right thing I need.

It occurred to me after my first post that I should have used chown to change the ownership of my FC files to the new UID I put in the /etc/passwd file, but it looks like usermod does all that for me.

I'll give all this a shot when I get back to the PC (i.e. home).

- Bruce
 
Old 03-04-2005, 02:13 AM   #5
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
Hey, mikshaw, you just solved a problem!
I have installed FC3 at work, but want to have same uid as at home (501).
I was thinking about doing it the hard way - changing uid's manually - usermod makes it easy! Thanks!
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
tar file installations sirclown82 Fedora 1 02-15-2005 07:33 PM
Software Installations (file structure) edzvan Linux - Newbie 3 01-28-2005 09:10 AM
Default File Access Privileges..! br_sriram Linux - Software 0 09-28-2004 11:10 PM
WINE freaks out on Windows System Files installations! Kujila Linux - Software 3 06-15-2004 02:19 PM
System changes requiring root privileges do not work nimcha Linux - Software 0 05-19-2004 01:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:44 AM.

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