Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I just created an account with name rashmi and set its password. Then I restarted my system. When I log in to rashmi another screen appears for less than a second and then vanish and again the login screen comes back. So I am not able to login in to Ubuntu from the newly created user

I created my user with sudo useradd rashmi, then set its password using sudo passwd rashmi.

Can anyone please tell me how to log in as a new user and where I am going wrong?

share|improve this question

1 Answer 1

By default useradd simply creates the user account and group in the /etc/passwd and /etc/group files. It does not create a home directory for the new user. Instead run the sudo adduser username command, which will prompt for extra information including password, full name, etc. and then create a home directory which will be populated from default information in /etc/skel.

To fix this, you have two options. The simplest would be to run sudo userdel rashmi, and then start again with the adduser command, or you could manually create the home directory as root user, and change the ownership of the copied files to match that of the new user:

ls /home/rashmi

Confirm that there is no data about to be overwritten. Then

sudo cp -a /etc/skel /home/rashmi
sudo chown -R rashmi:rashmi /home/rashmi

I recommend using the first method if possible, as it will add a usergroup for the new user, which you may not have done yet (you can do this manually by editing the /etc/group file as the root user).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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