Troubleshooting OMV/Pi – No /home/usr directory

While working on my Raspberry Pi, I got this error after SSHing in: Could not chdir to home directory : No such file or directory

The benefit of a home directory is that commands are logged, so that the next time one logs in, an up key press can bring up previous commands. Therefore, it would behoove me to fix this error.

This error may indicate that the directory does not exist, or that it’s not linked in the user file at /etc/passwd.

I first tried this command: usermod -d /home/USERNAME sudouser

But it doesn’t work when you are logged in through SSH as the user you want to change! I killed the process,  with kill, which logged me out and did nothing–except restart my getty/ssh process. Apparently, this would not work, because my session was affecting my ability to edit things.

So I opened up the user file with: sudo nano /etc/passwd

I added the home directory to my user, which looked something like this:


The important parts are at the back. You are using the Bash shell and running from the /home/pie directory. Note the number of colons used!

I edited the file and started another ssh session, but I couldn’t login as usual and I got this error: Could not chdir to home directory /bin/bash: Not a directory

What was the problem? Apparently, I didn’t use the correct number of colons. I had a “::” after my directory instead of just “:”. Remember to test your settings without logging out!

Problem solved, after a while.



References – 1, 2, 3