Monday, May 2, 2011

Enable tab completion for Mac OS X SSH client

I was befuddled recently when trying to get tab-completion for file and directory names working using the Mac OS X standard ssh client.  up-arrow didn't work either for scrolling through previous shell commands.

I asked a friend about this and he found this post which solved my issue.  If using 'bash' as the shell in the ssh session the tab and arrow keys functioned as expected.

What I did:

1) check /etc/passwd to see which shell I was using on the remote Linux system (cat /etc/passwd). It was /bin/sh
2) checked to see what /bin/sh was (ln -l /bin/sh). It was a link to 'dash'.
3) changed my entry in /etc/passwd to use /bin/bash (I used vi)
4) logged out/back in (not sure if that was required) and my tab and arrow keys worked as expected

 Update
I found that the proper way to do this is to use 'chsh' (change shell):

chsh -s /bin/bash <username>

No comments:

Post a Comment