Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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).
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!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.