su: warning: cannot change directory. No such file or directory

Solved2.52K viewsUbuntuubuntu

su: warning: cannot change directory. No such file or directory

I am facing issues after creating a new user and changing the user,

[[email protected]]# useradd user1
[[email protected]]# passwd user1
New password:
Retype new password:
passwd: password updated successfully
[[email protected]]# su - user1
su: warning: cannot change directory to /home/user1: No such file or directory

Share:
vito Selected answer as best September 21, 2021
0

The error is thrown because the home directory is not created for the user ‘user1’. Execute the below command,

sudo nano /etc/pam.d/system-auth

Go to the last line and add the below line in the file,

session optional /lib/security/$ISA/pam_mkhomedir.so

Save and exit.

Now execute the command to change the user and the error should not be thrown.

Share:
vito Selected answer as best September 21, 2021
1
You are viewing 1 out of 1 answers, click here to view all answers.