tl;dr: How do I correctly set my UID on Silverblue?
The initial user on Silverblue is given UID 1000.
I want my UID to match my UID on my other systems (100977).
I tried using usermod as usual, but I get an error that the user I’m trying to modify is in use.
I created a brand new user and tried usermod, and that appears to function as expected but my new user doesn’t get some of the things that the First User gets, such as entries in /etc/subuid and /etc/subgid
Is there something I’m missing? It seems that setting a custom UID ought to be an option during user creation.
You can manually edit /etc/passwd and change your user UID. You can also manually edit /etc/group and change your GID.
Note that doing so will require that those files are edited by root. Also note that changing the UID and GID will require using a chown command for the users home directory tree as well to change user and group ownership to the new user UID info.
It would be strongly encouraged to have a second user that is capable of sudo access before attempting this since it would not be nice to lock yourself out if something went wrong with the editing or ownership changes…
I am not sure why the UID change is needed since most tools to connect remotely use the user name for identification and not UID.
Setting an alternate UID during install would be extra complexity for an overwhelming majority of users. It can be changed after the install is completed if necessary.
The solutions proposed here appeared to work for a while, but now that I’m using toolbox, there are some serious issues.
Here’s sudo outside of a toolbox:
$ sudo ls -m
bar, baz, foo
Here’s sudo in a toolbox:
$ sudo dnf install ruby
sudo: /etc/sudo.conf is owned by uid 100977, should be 0
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
For some reason, while sudo and sudo.conf are owned by root normally, once I enter a toolbox they are seen as being owned by my user.