Find the answer to your Linux question:
Results 1 to 5 of 5
Hi all, I want to ssh a box say: Code: $ ssh -l a12345 boxname but, it is asking me to enter a password. I don't want to enter the ...
  1. #1
    Linux Newbie Sangal-Arun's Avatar
    Join Date
    May 2006
    Location
    Gurgaon, India + Denver Colorado USA
    Posts
    101

    Question how to ssh on a box without manually giving password at runtime

    Hi all,

    I want to ssh a box say:
    Code:
    $ ssh -l a12345 boxname
    but, it is asking me to enter a password. I don't want to enter the password at runtime...means it should take the password automatically if somehow we provide it at the command prompt.... I thought using:

    Code:
    $ echo "mypassword"|ssh -l a12345 boxname
    but still ssh command is asking me to enter the password though i have provided it at the command prompt using echo command.

    Is there any way to achieve this.
    Thanks-
    Brgds,

    ARUN SANGAL
    SCM: 1- 720 251 9962
    Email: sangal.ak04@gmail.com
    Email: sangal_ak04@yahoo.com

  2. #2
    Linux Newbie unchiujar's Avatar
    Join Date
    Oct 2006
    Posts
    194
    You can use a key file instead of a password. From the man pages:

    Code:
    -i identity_file
                 Selects a file from which the identity (private key) for RSA or DSA
                 authentication is read.  The default is ~/.ssh/identity for protocol
                 version 1, and ~/.ssh/id_rsa and ~/.ssh/id_dsa for protocol version
                 2.  Identity files may also be specified on a per-host basis in the
                 configuration file.  It is possible to have multiple -i options (and
                 multiple identities specified in configuration files).
    You will need ssh server that is set up to accept authentication through key pairs

  3. #3
    Linux Newbie Sangal-Arun's Avatar
    Join Date
    May 2006
    Location
    Gurgaon, India + Denver Colorado USA
    Posts
    101

    Lightbulb

    Using ssh-keygen...and creating all necessary files and running the ssh-agent, Im able to run any command on target box/host without entering the password at command prompt or specifying it at the command prompt.

    But,
    NOTE: It would be appreciated if we don't go for creating the .pub and authorized_keys files on target host. Means, I just want to give the password at command prompt while calling ssh -l ..userid.. boxname... and that too in encrypted form...not visible to any other user if he runs history command and later do some crazy things using my userid/password.
    "gpg" command can be used for this...but i have never used it before.


    Thanks-
    Brgds,

    ARUN SANGAL
    SCM: 1- 720 251 9962
    Email: sangal.ak04@gmail.com
    Email: sangal_ak04@yahoo.com

  4. #4
    Linux Newbie unchiujar's Avatar
    Join Date
    Oct 2006
    Posts
    194
    A possible solution

  5. #5
    Just Joined! aliosa27's Avatar
    Join Date
    Jan 2007
    Posts
    10
    ssh [Remote address] "echo $(cat /root/.ssh/id_dsa.pub) >/root/.ssh/authorized_keys"

    It will ask for your password like normal...after you put it in, try sshing in..you should not need a password again..
    Last edited by aliosa27; 08-19-2007 at 06:20 AM. Reason: forgot a line

Posting Permissions

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