Although I have explicitly specified a home directory for a newly added user, after the login, there is no home for that user.
mahmood@ubuntu1604:~$ sudo useradd test -d /home/test -s /bin/bash
mahmood@ubuntu1604:~$ sudo passwd test
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
mahmood@ubuntu1604:~$ su - test
Password:
No directory, logging in with HOME=/
test@ubuntu1604:/$ ls /home/test
ls: cannot access '/home/test': No such file or directory
/home/test
already exist? if not, the-d
option is not sufficient - you also need-m
or--create-home
– steeldriver Jun 21 '19 at 10:34