1

I have kubuntu 16.04 running. I wanted to setup a permanent mount to my synology NAS and following their tutorial I adapted my userid to the one on the synology.

I created a new user on my machine with sudo rights and typed the following:

sudo usermod -u 1026 -g 100 myoldlogin

So my new user can login via Plasma, the new and old user can login via terminal, but my old user cannot login anymore via Plasma GUI.

My olduser now really has the userid 1026.

What went wrong, how can I fix this?

5
  • Not sure, but you assigned your account a GID (group ID) of 100. Usually normal users have GIDs above 1000 because the lower ones are used by the system. I could imagine that Plasma desktop only allows graphical login for non-system users by comparing their UID/GID, but this is only a guess. I recommend to assign that account the same GID as its UID, i.e. 1026. Does that solve the problem? – Byte Commander Jun 26 '16 at 16:47
  • I tried that and gave myolduser the group 1000. I first tried with 1026, but that did not exist. But login via gui still does not work. It takes some time, then I shortly see a black screen and then I am back to my plasma login screen. – Calamity Jane Jun 26 '16 at 17:09
  • Okay. I'm not sure whether taking group 1000 is the best way to go, but maybe you can now look at askubuntu.com/questions/223501/… and try the suggestions there. It might be a permission problem now. Or simply try a sudo chown -R 1026:1000 /home/OLDUSERNAME to make sure your user still has ownership over its home directory. – Byte Commander Jun 26 '16 at 17:24
  • if I do a sudo ls -l /home/myolduser all files and folders are still shown as owned by the old user. However I let your script run with verbose switched on and some files were changed. Next feedback after reboot. – Calamity Jane Jun 26 '16 at 17:43
  • Yaey that did the trick! Do you want to post it as answer, then I will check this as solved. Thanks for your quick help! – Calamity Jane Jun 26 '16 at 17:47
1

First of all, group IDs (GID) below 1000 are used by the system and other no-login groups and usually not as primary group for normal user accounts. You should give your user a GID above 1000, ideally the same number as its user ID (UID).

Second, file system ownership is bound to user/group IDs, not names. Therefore changing your account's UID and GID will make it lose all rights on files it owned before.

This means you have to reassign the ownership of that account's home directory to the new UID/GID pair. The most important file here is probably the ~/.Xauthority file. If that one is not owned by the correct user, it will not be able to log into the graphical desktop.

You recursively change the ownership of a directory with this command:

sudo chown -R USER:GROUP DIRECTORY

Simply replace USER and GROUP with the respective name or ID and use your old user's home directory (e.g. /home/myoldlogin) as DIRECTORY. The command you have to run could then look like this:

sudo chown -R 1026:1000 /home/myoldlogin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.