Re: SSH password prompt in Shell Script

On 2006-03-02, Pramod <pramod.shimoga@xxxxxxxxx> wrote:
I need to use ssh to connect different target boxes using Public and
private keys.
Is there is any way in ssh where we can check weather the keys are
already set or not.
Generally if the key based authentication fails it will prompt for
*password*. But in my script I don't want SSH to prompt for password,
just it has to return with failure message.

If you're using OpenSSH: ssh -opreferredauthentications=publickey server.
(or if you're using Protocol 1, PasswordAuthentication=no and/or
ChallengeResponseAuthentication=no). The ssh_config(5) man page has
the details.

Darren Tucker (dtucker at
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.

Relevant Pages

  • Re: Opening ports in my firewall
    ... >> only with DSA keys, and not allowing manual password logins. ... - copy the .ssh directory to the new machine, if you control it, or ... Walter Dnes; my email address is *ALMOST* like ...
  • RE: sshd / ssh setup
    ... USA server and his windows/xp notebook to use SSH. ... followed sshd instruction and built ... and require users to submit keys. ...
  • Re: SSH via Expect disconnects
    ... using autoexpect was the answer (please refer to thread ... >> I have received one suggestion that I explore the idea of using keys ... >> have poured through the manpage for Expect as well as SSH, ... >>> I am using an expect script to initiate an SSH session to another host ...
  • Re: Firewall security: Re: Problems with simple Samba file share
    ... Man ssh ... ... Why is that, Peter? ... The firewall does help protect ... against someone stealing the keys and using them at another location. ...
  • Re: Ported tools and SSH
    ... auditors are grumbling about SSH because it stores its keys in the open. ... simple and steps can often be taken to meet security requirements. ... Consider first z/OS SSH as a server: ...