Use previous users already present in Linux Home directory

I recently installed a fresh copy of Ubuntu 16.04.0 LTS on my server PC. I mounted my earlier /home directory to it. It consisted of multiple user accounts that were previously made. But after installation, none of that account showed on the login screen. Now, I recreated those account using same earlier information (i.e. Name, Username .etc), but now whenever they try to login from the login screen, they are unable to do so while when they use ssh for login, the following message is shown:

Error message after login using ssh

Moreover, there are some directory ownership issues as well. Could somehow help in solving the problem.

1 Answer

Make sure that the uid and gid of the new accounts you made match the uid and gid in the old /home directories. E.g. looking at /etc/passwd will give you the uid and gid in the third and fourth fields, respectively. An 'ls -la /home' will give you the uid and gid recorded in the file system.

If these do not match, you will need to do 'chown -R uid:gid /home/user' where uid and gid are the values from /etc/passwd. You will also need to make sure that 'user' in /home/user matches the value in /etc/passwd. You can change that value, if needed, with 'usermod'.

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like