So I have a task I'm supposed to do and I need to login using a username I have created, which I did sudo useradd (username), and also added a password using sudo passwd (username), which all worked out fine. But when I try to login I get an error saying, No Directory, logging in with HOME=/. I tried entering the wrong password to see if my previous code for adding user was wrong, and it did say su: Authentication failure, so I do not have an idea on what to do next, any help explaining and giving an answer would be appreciated, Thank you!
Asked
Active
Viewed 845 times
0
Chris Davies
- 116,213
- 16
- 160
- 287
JAck
- 75
1 Answers
3
When you created the new user, you didn't create a user home folder which usually is located in /home/<username>, that's why there is no HOME variable. To create a user with a home folder you should do sudo useradd -m <username>, with the -m you are creating the /home/<username> folder. You should also consider add the user to the users group, to create a user that is in the users group, do sudo useradd -m -g users <username>
Parker
- 181
- 2
sudoandsuin the same command. For yoursudo su - (username)just usesudo -u (username) -s(orsudo -su (username)if you prefer the two options joined together). – Chris Davies Mar 17 '22 at 23:13