Tab Completion In Emacs shell-mode SSH Sessions

Emacs can't track the current directory (default-directory) when ssh-ing to other machines.

You could set default-directory to a tramp file-name like /ssh:YOURHOST:/home/dir" on your current shell-buffer manually.

I start shell-sessions on a remote machine mostly via tramp-bookmarks/shell. Tramp sets default-directory automatically. But there is a bug in directory tracking on remote files, which is fixed in trunk (unreleased).

http://comments.gmane.org/gmane.emacs.bugs/39082


Instead of running M-x shell and running ssh to the remote computer, visit a directory on the remote computer (using Tramp) and then run M-x shell in that Dired buffer.