Results 1 to 6 of 6

Thread: SSH: Asking "Are you sure you want to continue connecting (yes/no)?" Every Time?

  1. #1
    Join Date
    Jun 2006
    Location
    Georgia
    Beans
    1,072

    SSH: Asking "Are you sure you want to continue connecting (yes/no)?" Every Time?

    Is there a way, after running the ssh XXX.XXX.XXX.XXX command to ask "Are you sure you want to continue connecting (yes/no)?" every time that it is ran?
    Acer Aspire 3680, Intel Celeron M, 1.41 GB RAM
    Feel free to message me if you have any questions.

  2. #2
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,239
    Distro
    Kubuntu

    Re: SSH: Asking "Are you sure you want to continue connecting (yes/no)?" Every Time?

    That particular ssh question should only be asked once. If you acknowledge the question with a "yes", then an entry is placed within your ~/.ssh/known_hosts file.

    Make sure that your ~/.ssh directory has the following permission mode set: 700.
    Code:
    chmod 700 ~/.ssh
    Then make sure that your ~/.ssh/known_hosts has the following permission mode: 600
    Code:
    chmod 600 ~/.ssh/known_hosts
    If you have entries within your ~/.ssh/known_hosts that conflict with an entry you are trying to add, then remove the offending entry.

    P.S. If you do not have a ~/.ssh directory, then create it before make the chmod changes noted above.
    Last edited by dwhitney67; July 23rd, 2011 at 05:57 PM.

  3. #3
    Join Date
    Jun 2006
    Location
    Georgia
    Beans
    1,072

    Re: SSH: Asking "Are you sure you want to continue connecting (yes/no)?" Every Time?

    Quote Originally Posted by dwhitney67 View Post
    That particular ssh question should only be asked once. If you acknowledge the question with a "yes", then an entry is placed within your ~/.ssh/known_hosts file.

    Make sure that your ~/.ssh directory has the following permission mode set: 700.
    Code:
    chmod 700 ~/.ssh
    Then make sure that your ~/.ssh/known_hosts has the following permission mode: 600
    Code:
    chmod 600 ~/.ssh/known_hosts
    If you have entries within your ~/.ssh/known_hosts that conflict with an entry you are trying to add, then remove the offending entry.

    P.S. If you do not have a ~/.ssh directory, then create it before make the chmod changes noted above.
    Thanks, but I still have some problems.

    See, I have a script that connects with ssh. If the user has never connected to that host before they will be prompted. If they have, however, they won't be. I am using an expect script to answer the questions, and I can't find a way to account for both situations without simply asking every time.
    Acer Aspire 3680, Intel Celeron M, 1.41 GB RAM
    Feel free to message me if you have any questions.

  4. #4
    Join Date
    Feb 2006
    Location
    Vancouver, BC, Canada
    Beans
    318

    Re: SSH: Asking "Are you sure you want to continue connecting (yes/no)?" Every Time?

    You can disable strict checking of host keys. With this setting, ssh will connect even if the host key is not found in the known_hosts file.

    You can do it on the command line this way:
    Code:
    ssh -o "StrictHostKeyChecking no" XXX.XXX.XXX.XXX
    Or you can update your ~/.ssh/config to include this setting.

    For more information:
    Code:
    man ssh_config | less -p StrictHostKeyChecking

  5. #5
    Join Date
    Jan 2006
    Beans
    Hidden!
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: SSH: Asking "Are you sure you want to continue connecting (yes/no)?" Every Time?

    Quote Originally Posted by stylishpants View Post
    You can disable strict checking of host keys. With this setting, ssh will connect even if the host key is not found in the known_hosts file.

    You can do it on the command line this way:
    Code:
    ssh -o "StrictHostKeyChecking no" XXX.XXX.XXX.XXX
    Or you can update your ~/.ssh/config to include this setting.

    For more information:
    Code:
    man ssh_config | less -p StrictHostKeyChecking
    at one point I had an expect script to roll through 90 servers via ssh, the quoted post is the method I used. I have come to memorize that option.
    I am infallible, you should know that by now.
    "My favorite language is call STAR. It's extremely concise. It has exactly one verb '*', which does exactly what I want at the moment." --Larry Wall
    (02:15:31 PM) ***TimToady and snake oil go way back...
    42 lines of Perl - SHI - Home Site

  6. #6
    Join Date
    Sep 2009
    Location
    UK
    Beans
    434
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: SSH: Asking "Are you sure you want to continue connecting (yes/no)?" Every Time?

    Is there a way, after running the ssh XXX.XXX.XXX.XXX command to ask "Are you sure you want to continue connecting (yes/no)?" every time that it is ran?
    there are three ways to ensure that you are asked the permissions every time...

    1. permissions as noted above, although i would have gone with 400 on the known hosts, so no-one can write to the file? rather than 600?

    2. a wrapper script to remove the line from the known_hosts

    3. a wrapper script to replace ssh command (update-alternatives, mv ssh, call ssh from new script), new script can have custom read from user...
    My personal website with blog n apps
    http://www.mikejonesey.co.uk/

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
  •