Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: HOWTO: Speed up SSH login

  1. #1
    Join Date
    Oct 2005
    Beans
    28

    HOWTO: Speed up SSH login

    If you execute the command:

    Code:
    ssh username@hostname
    and it takes a good 10-15 seconds to prompt you with a login/password, and you don't want it to take 10-15 seconds, then you've come to the right place.

    You can blame IPv6 for this. Execute:

    Code:
    ssh -4 username@hostname
    Note the -4 argument. This forces ssh to use only IPv4. If this doesn't speed it up, then you're probably out of luck.

    Now, if you don't want to type -4 all the time (or are using CVS with ssh), edit your ssh_config file like so:

    Code:
    sudo gedit /etc/ssh/ssh_config
    add the line
    Code:
    AddressFamily inet
    Now you're set.
    Last edited by Jacky_J; October 31st, 2005 at 08:26 PM.

  2. #2
    Join Date
    Nov 2004
    Beans
    11

    Re: HOWTO: Speed up SSH login

    Works as advertised, thanks, very useful tip

  3. #3
    Join Date
    Aug 2005
    Beans
    95

    Re: HOWTO: Speed up SSH login

    Such a simple thing, yet it makes ssh so much nicer.

    Thanks!

  4. #4
    Join Date
    Jul 2005
    Beans
    431

    Re: HOWTO: Speed up SSH login

    Thanks! Much faster... If only I could figure out a way for SSH to remember my passphrase for my ssh key.............

    -m

  5. #5
    Join Date
    Oct 2005
    Beans
    27

    Lightbulb Re: HOWTO: Speed up SSH login

    Quote Originally Posted by majikstreet
    Thanks! Much faster... If only I could figure out a way for SSH to remember my passphrase for my ssh key.............

    Code:
    riggs@ubuntu:~ $ apt-cache show keychain
    Package: keychain
    Priority: optional
    Section: universe/net
    Installed-Size: 136
    Maintainer: Cesar Mendoza <mendoza@debian.org>
    Architecture: all
    Version: 2.5.5-3ubuntu2
    Depends: debconf (>= 1.2.0), openssh-client | ssh-client, grep (>= 2.4.2-1)
    Filename: pool/universe/k/keychain/keychain_2.5.5-3ubuntu2_all.deb
    Size: 33100
    MD5sum: 37e60562c707fe032028fd3280bff756
    Description: key manager for OpenSSH
     Keychain is an OpenSSH key manager, typically run from ~/.bash_profile. When
     keychain is run, it checks for a running ssh-agent, otherwise it starts one.
     It saves the ssh-agent environment variables to ~/.keychain/\-sh,
     so that subsequent logins and non-interactive shells such as cron jobs can
     source the file and make passwordless ssh connections.  In addition, when
     keychain runs, it verifies that the key files specified on the command-line
     are known to ssh-agent, otherwise it loads them, prompting you for a password
     if necessary.
    Bugs: mailto:ubuntu-users@lists.ubuntu.com
    Origin: Ubuntu

  6. #6
    Join Date
    Jul 2005
    Beans
    431

    Re: HOWTO: Speed up SSH login

    and I use it how?

  7. #7
    Join Date
    Oct 2005
    Beans
    28

    Re: HOWTO: Speed up SSH login

    This is how I did it:

    Basically, you need these files on your remote host:
    ~/.ssh/id_rsa
    ~/.ssh/id_rsa.pub
    ~/.ssh/authorized_keys

    Then, on your local, you should have a copy of id_rsa
    ~/.ssh/id_rsa

    If you don't know how to make those files, ssh to your remote host and execute

    Code:
    ssh-keygen -t rsa
    enter in your passphrase, then do

    Code:
    cp .ssh/id_rsa.pub .ssh/authorized_keys
    Then you need to copy id_rsa into your local .ssh directory (use scp or sftp)

    after you have all the necessary files, execute

    Code:
    ssh-add
    ssh-add should detect that you have a id_rsa file and asks for your passphrase. After you do this, you should be able to ssh without a password.
    However, you need to do this everytime you boot your computer.

    Ubuntu is nice because it has an ssh-agent ID ready to go, so you don't need to mess around with keychain.

  8. #8
    Join Date
    Jul 2005
    Beans
    431

    Re: HOWTO: Speed up SSH login

    ahh.. is there any way to put the password in the command?

  9. #9
    Join Date
    Oct 2004
    Location
    Cupertino, CA
    Beans
    5,092
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO: Speed up SSH login

    It's gonna be more secure for you to just leave the passphrase blank. Typing in a password as a part of a command is typically a bad idea. Not only is it displayed to any user doing a 'ps aux', but it also tends to get logged in ~/.bash_history, which by default is world-readable (I change that on all my workstations).

    The downside is that if anyone manages to steal your ~/.ssh directory (usually requires physical access), they have full password-free access to any systems you use non-passphrased authentication to, until you realize what happened and remove the key's entry from authorized_keys on the server's end.
    Quote Originally Posted by tuxradar
    Linux's audio architecture is more like the layers of the Earth's crust than the network model, with lower levels occasionally erupting on to the surface, causing confusion and distress, and upper layers moving to displace the underlying technology that was originally hidden

  10. #10
    Join Date
    Jul 2005
    Beans
    431

    Re: HOWTO: Speed up SSH login

    That sucks..... I guess I'll just type in the password

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •