Ubuntu – ‘unreachable’ home folder

ecryptfsfilesystemhome-directoryssh

Occasionally, when I log into my Ubuntu server, the prompt says jon@jon-server:(unreachable)/$. Running pwd at this point returns (unreachable)/, however echo $HOME returns /home/jon as expected. If I cd then I get taken to my actual home folder.

What could be the reasons for this? It doesn't seem to cause any problems, apart from public key authentication with SSH (presumably if it can't see the home folder then it can't get to the .ssh folder inside it). It seems to be consistent until restart – that is, every new shell will do this, until I restart, when it will either work normally or not.

This has been happening for at least the last few release upgrades, so not related to Oneiric. I selected the installer option to encrypt my home folder.

Best Answer

The question and answer for Is it possible to use the 'screen' command to work with files on an encrypted home directory? helped me understand why this might be happening: being logged in via screen with ssh doesn't tell Ubuntu that you're still using the system and so after a while (overnight in my case) the encrypted home directory gets unmounted, so Vim can't save files it had open in screens, and the working directory on the command prompt becomes (unreachable).

I know that the problem goes away if I have an NX session logged in. NX might be described as screen for GUI; I just start an NX session and disconnect it (letting it run the background), and can continue using ssh/screen indefinitely. Not elegant or ideal but I use NX occasionally so it worked for me.

The linked question also suggests deleting the empty file in /home/.ecryptfs/$USER/.ecryptfs/auto-umount. This might help if you don't use NX.