Running is therapy

My life. As I remember it. Or as it was told to me the next day.
  • Home
  • Current Schedule
  • Personal Records
  • Upcoming Races

Ubuntu, ssh, known_hosts, tab completion

Published by Nathan Powell on May 16, 2007 07:15 pm under computers

I have to look this up from time to time, putting it here.

On Ubuntu, they have ‘HashKnownHosts yes’ set by default in /etc/ssh_config. This is annoying if you want to use bash completion to tab complete host names for ssh. Change that to no, and you are all set.

8 Comments so far

  1. Patrick on May 16th, 2007

    Can’t you just add the hosts to /etc/hosts? That increases your security, to boot!

  2. Nathan Powell on May 16th, 2007

    I am not sure I follow?

  3. Patrick on May 16th, 2007

    Switch your bash completion to use /etc/hosts instead of ~/.ssh/known_hosts. e.g.

    complete_hosts() {
    COMPREPLY=( $( compgen -W ‘$( command grep -v ^# /etc/hosts )’ — ${COMP_WORDS[COMP_CWORD]} ) );
    }
    complete -F complete_hosts ping
    complete -F complete_hosts ssh

  4. Nathan Powell on May 17th, 2007

    Oh, I see. Well that’s a little less convenient. When you accept the key, it puts the ip/hostname in known_hosts for you. Less typing! :)

    Plus I don’t usually put things in /etc/hosts unless I have to. I have a habit of forgetting, and then when there is DNS trouble, I sit there saying “Works fine here, must be a user error” :)

  5. Patrick on May 17th, 2007

    Ok, so basically you’re disabling an Ubuntu default in order to gain more convenience? But did you lose some security in doing so?

    Like in Ubuntu, do they tweak your default bash_logout to remove ssh/scp/etc. entries?

  6. Nathan Powell on May 17th, 2007

    Yes, there is a slight hit to security. I think it’s worth it.

    No, they do not remove those that I am aware of.

  7. Patrick on May 17th, 2007

    there’s a good write-up on http://lwn.net/Articles/135506/

    basically, use hashknownhosts and set HISTIGNORE=”ssh *:scp *” in your shell to up security.

    if you use gpg-agent, you could even encrypt your ~/etc/hosts and decrypt on the fly for use in completions. ;)

  8. Nathan Powell on May 17th, 2007

    Not everything is worth my time ;)

Posting your comment.

  • Search

  • Archives

    • December 2008 (5)
    • November 2008 (2)
    • October 2008 (10)
    • September 2008 (4)
    • August 2008 (10)
    • July 2008 (11)
    • June 2008 (14)
    • May 2008 (15)
    • April 2008 (10)
    • March 2008 (16)
    • February 2008 (17)
    • January 2008 (37)
    • December 2007 (21)
    • November 2007 (30)
    • October 2007 (29)
    • September 2007 (22)
    • August 2007 (30)
    • July 2007 (49)
    • June 2007 (32)
    • May 2007 (29)
    • April 2007 (38)
    • March 2007 (26)
    • February 2007 (25)
    • January 2007 (23)
    • December 2006 (10)
    • November 2006 (12)
    • October 2006 (9)
    • September 2006 (9)
    • August 2006 (5)
    • July 2006 (13)
    • June 2006 (9)
    • May 2006 (8)
    • April 2006 (11)
    • March 2006 (12)
    • February 2006 (12)
    • January 2006 (13)
    • December 2005 (15)
    • November 2005 (19)
    • October 2005 (8)
  • Categories

    • blather (64)
    • books (10)
    • computers (178)
    • cooking (1)
    • economics (3)
    • emacs (3)
    • football (1)
    • gaming (1)
    • hiking (5)
    • housekeeping (5)
    • lifehacking (7)
    • music (3)
    • paddling (2)
    • personal (1)
    • politics (21)
    • programming (71)
    • running (241)
    • smoking (40)
    • sysadmin (11)
    • tlc (10)
    • Uncategorized (1)
  • Pages

    • Current Schedule
    • Personal Records
    • Upcoming Races

Copyright © 2009 Running is therapy
WordPress Theme based on Light Theme