SSH login without password

You set up a cron job and searching for -p parameter to pass ssh, for auto login. There is no such parameter. But there are many mechanisms to allow us authonize throgh. Like RSA autothentication.
The logic is give your public key to other host. Then it will identify you and let you pass in.

You want to backup server to rsync DB server to update lastest db dumps. I've created backupUser at DB server and File servers.

On backup server create RSA key.
ssh-keygen -t rsa
It will create both private key and public key, the former will be put to DB server

Generating public/private rsa key pair.
Enter file in which to save the key (/home/nerkn/.ssh/id_rsa):

Accept the file path. Then it will ask passphase ( which is password you want to use). Since you dont want passphase pass it alone by entering enter.

Now you have public key, I cat contents and copied. Then login to DB server to paste it.

cat /home/nerkn/.ssh/id_rsa.pub
ssh backupUser@DBServer
nano -w .ssh/authorized_keys

Paste your public key.
If there is no .ssh folder, ssh back to the backup server. You wont bother permissions of .ssh folder. When you accept it as a known host.

Log off. And give a try.

ssh backupUser@DBServer

If you again need to enter password. You should tweak your DBServer to accept RSA auth. mechanism.

nano -w /etc/ssh/sshd_config

Only one of my servers, RSA auth is not by default.
Find and change

RSAAuthentication yes

Log off and try again.
if it doen't work anyway, you can investigate what is going on while authentication ask for the verbose mode.


ssh -v backupUser@DBServer

It's like magic. That there is no prompt for you to enter pass.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
            .d8888b.    .d8888b.                 888  888      
d88P Y88b d88P Y88b 888 888
888 Y88b. d88P 888 888
88888b. .d88P "Y88888" 888d888 .d88888 88888b.
888 "88b .od888P" .d8P""Y8b. 888P" d88" 888 888 "88b
888 888 d88P" 888 888 888 888 888 888 888
888 d88P 888" Y88b d88P 888 Y88b 888 888 d88P
88888P" 888888888 "Y8888P" 888 "Y88888 88888P"
888
888
888
Enter the code depicted in ASCII art style.

Similar

  • New technique to win olimpics -

    New technique to win olimpics

    At the 1968 Olympics, Dick Fosbury took the athletics world by surprise with an unusual high-jump technique.

  • Printing mysql_error -

    Printing mysql_error

    This is a code snipped to print mysql error.
    If there is no error mysql_error returns null, thus if evaluates false and there is no output.

  • multiple ON DUPLICATE KEY UPDATE -

    multiple ON DUPLICATE KEY UPDATE

    Here is an example of how to update multiple columns using values supplied in the INSERT statement. This assumes that column 'a' is the unique key.

  • multiple ON DUPLICATE KEY UPDATE -

    multiple ON DUPLICATE KEY UPDATE

    Here is an example of how to update multiple columns using values supplied in the INSERT statement. This assumes that column 'a' is the unique key.

  • php unlink recursive -

    php unlink recursive

    The shortest recursive delete possible.

    <?php
    /**
    * Delete a file or recursively delete a directory
    *
    * @param string $str Path to file or directory
    */