banner
Previous Page
PCLinuxOS Magazine
PCLinuxOS
Article List
Disclaimer
Next Page

Tip Top Tips: Change User Account UID & GID


Editor's Note: Tip Top Tips is a semi-monthly column in The PCLinuxOS Magazine. Periodically, we will feature – and possibly even expand upon – one tip from the PCLinuxOS forum. The magazine will not accept independent tip submissions specifically intended for inclusion in the Tip Top Tips column. Rather, if you have a tip, share it in the PCLinuxOS forum's “Tips & Tricks” section. Occasionally, we may run a “tip” posted elsewhere in the PCLinuxOS forum. Either way, share your tip in the forum, and it just may be selected for publication in The PCLinuxOS Magazine.

This month's tip was started by Seacht, and added to by others from the forum. Let's try to distill it down from those various posts.

Here's Seacht's original post:

Recent changes to the UID used by default on PCLinuxOS ISOs have changed from 500 to 1,000 for the first user created. Should you wish to change your existing user IDs, these two commands are useful.

As root:

To assign a new UID to an existing user:

usermod -u 1000 

To assign a new GID to an existing group:

groupmod -g 1000 

All files and folders in the user's home directory will automatically change the UID and GID. However, files and folders outside ~/user will need to be changed manually.

That post led to a question from AnalogueMan about another command that Texstar had previously posted. Namely, that command from Texstar is

chown -R username:username /home/yourloginname.


Approved
Compounded image from Clker-Free-Vector-Images on Pixabay

To answer AnalogueMan's question, kjpetrie responded with the following:

That is an alternative command which works a different way in a different situation. Seacht's command is for changing the UID/GID of the existing system without reinstalling to bring it into line with the ISOs and prevent having to use Texstar's command if you do subsequently need to reinstall.

Texstar's command is for use after reinstalling if your files still have the old IDs, though there is the alternative of using Seacht's command the other way round to restore the system to the previous IDs.

So it's either one or the other, but usually not both.

There are subtler issues if you've set up multiple users and groups to maximize your use of UNIX permissions, but if you've done that, you will have the knowledge to work out your best way to restore the intended access after reinstalling.

Armed with that information, AnalogueMan attempted to execute Seacht's commands, after using su - to switch to the root user. Something went awry.

tbs chimed in that it will work much better to open a virtual tty window (Ctrl + Alt + [F1-F7]), log in as the root user, execute the commands, and then reboot. When you log back in, your userid and groupid should both be set to the current user and group ID of 1000. To return to the GUI interface of PCLinuxOS, press a combination of the Ctrl + Alt + F8 keys.

Keep in mind that Seacht's command ONLY works on files stored in the user's /home directory. As bliss and Gerrit Draisma pointed out, any files on external drives (or any other files NOT stored in the user's /home directory) will need to use a different command to change the ownership of those files. That command has to be entered as the root user, and it is:

chown -R username:username /path/to/folder/you/want/to/change/permissions/for

That led to another question by AnalogueMan, about why the PCLinuxOS installer update changed the UID and GID from 500 to 1000.

Seacht had the answer:

“Most other Linux distros use IDs of 1,000 and up, so changing PCLOS allows user files to be read by other distros, and [the] PCLinuxOS user to read other distro user files, without the necessity of changing ownership.”<(i>)

And that, as the legendary broadcaster Paul Harvey was famous for saying, is the REST of the story!



Previous Page              Top              Next Page