LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Changing my numeric user id (https://www.linuxquestions.org/questions/linux-general-1/changing-my-numeric-user-id-702781/)

openSauce 02-06-2009 12:49 PM

Changing my numeric user id
 
Hi,

now that I'm pretty comfortable with Fedora, I've decided to start playing with Slackware a bit. I have an ext3 filesystem I'd like to share between the two distros, with both taking the owner of the files to be the one non-system user on each distro.

Unfortunately, Fedora user ids start at 500 by default, whereas Slack starts them at 1000. I think the easiest thing to do is to change the Fedora user's numeric id to 1000. Is this as simple as amending /etc/passwd and chowning /home on the Fedora install, or is there more to it than that? Do I need to do anything with /etc/shadow? Are there things going on in the background that expect my numeric id not to change?

theNbomr 02-06-2009 01:51 PM

AFAIK, you can simply modify /etc/passwd as appropriate, and any new logins for the respective use will assume the new ID. You probably want to make the accordant change in /etc/group, as well. Any files that are owned by an abandoned UID can be chowned as necessary. Existing logins may misbehave if file permissions change in unexpected ways.
I have encountered the same issue, and fixed the problem as described.
--- rod.

John VV 02-06-2009 08:30 PM

make a new user in fedora and manually set the uid to 1000
system / admin/ users & groups

GazL 02-07-2009 05:08 AM

By default slackware's users start at 1000, but there are no system userid's over 100, so you could quite happily just specify 500 as the uid when you create the user under slackware and then you don't have to change anything.

openSauce 02-07-2009 05:31 AM

Quote:

Originally Posted by theNbomr (Post 3434438)
AFAIK, you can simply modify /etc/passwd as appropriate, and any new logins for the respective use will assume the new ID. You probably want to make the accordant change in /etc/group, as well. Any files that are owned by an abandoned UID can be chowned as necessary. Existing logins may misbehave if file permissions change in unexpected ways.
I have encountered the same issue, and fixed the problem as described.
--- rod.

Unfortunately this didn't go well. After updating /etc/passwd and /etc/group, and chowning my home dir, I was unable to log in.

As the services are getting initialised at boot time, I get the following error message repeatedly:

Quote:

Unknown username "root" in message bus configuration file
Could not get password database information for UID of current process: User "???" unknown or no memory to allocate password entry
Eventually the message stops repeating and ends with:
Quote:

Failed to start message bus: Could not get UID and GID for username "dbus" [FAILED]
Then most of the remaining services start successfully, apart from Avahi, which says [FAILED] but gives no error message.

Then after waiting several minutes with no messages, X fails to start and I'm presented with a text logon screen, but I can't login with either my normal username or root, it just gives the error message "Login incorrect".

I've now reverted /etc/passwd and /etc/shadow to their previous contents, but get exactly the same errors.


I checked there were no conflicts with another user/group having id 1000. The entries for the dbus user in the various files are
Quote:

/etc/passwd: dbus:x:81:81:System message bus:/:/sbin/nologin
/etc/shadow: dbus:!!:14005:0:99999:7:::
/etc/group: dbus:x:81:
I'm not sure if that's problematic - my understanding is that a disabled account has "*" in the password field, not "!!". Googling for the first line of my error message, I found one hit where somebody got the same message after updating /etc/passwd, but it relates to changing passwords, which I haven't done, and the suggestion to change a password using passwd seems unlikely to do anything in my situation.

Does anyone have any suggestions? I do have a recent backup of the system partition, but would prefer not to use it if possible as I've just downloaded > 1GB of package updates.

openSauce 02-07-2009 05:33 AM

Quote:

Originally Posted by GazL (Post 3434996)
By default slackware's users start at 1000, but there are no system userid's over 100, so you could quite happily just specify 500 as the uid when you create the user under slackware and then you don't have to change anything.

Thanks, if I can get Fedora working again I'll probably do just that! Should have waited a couple more hours before having a go and I'd have seen this reply...

openSauce 02-11-2009 06:07 PM

Should have guessed, SELinux was up to its old tricks again. It turns out modifying /etc/{passwd,group} in single-user mode reset their security contexts, which could be returned to the correct values with restorecon.

For anyone else doing the same thing, there are also various Gnome config files scattered round the filesystem for which I was the owner. These can be chowned to the new uid with the commands
Code:

find / -user oldUID -exec chown newUID \{\} \;
find / -group oldGID -exec chown .newGID \{\} \;



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