Tuesday, 24 July 2018

su: warning: cannot change directory to /home/user: No such file or directory(/home/pmta1)

su: warning: cannot change directory to /home/user(pmta1): No such file or directory(/home/pmta1)

My Case: user is : pmta1

[root@sankar-sysops]# su - pmta1
su: warning: cannot change directory to /home/pmta1: No such file or directory

-bash-4.1$ pwd
/root

-bash-4.1$ exit
logout

[root@sankar-sysops]#  cat /etc/passwd |grep pmta1
pmta1:x:701:701::/home/pmta:/bin/bash

[root@sankar-sysops]# ls -l /home/pmta1  (no directory existed)

I've add below entry to /etc/pam.d/system-auth

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


[root@sankar-sysops]#  vim /etc/pam.d/system-auth
...
...
...
session optional /lib/security/$ISA/pam_mkhomedir.so

:wq!

[root@sankar-sysops]# su - pmta1
Creating directory '/home/pmta1'

[pmta1@sankar-sysops]$