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
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.