1833760 Members
2190 Online
110063 Solutions
New Discussion

Re: ssh without password

 
networking
New Member

ssh without password

Hi,
I have the necessity to run a korn shell on a remote server (both HP-UX servers) using the ssh command.

The sintax that I use is

ssh -l command(ksh script)

Pressing enter I need to set the password of the remote user. Is it possible to evoid to insert the password? In this way I can insert in may local ksh script the above command.

Many thanks in advance for your kind cooperation.

Giovanni
8 REPLIES 8
spex
Honored Contributor
networking
New Member

Re: ssh without password

Many thanks for the quick reply!

Giovanni
networking
New Member

Re: ssh without password

Hi again.
After reading the documentation and following the steps I have the same problem asking the remote password.
I try to explain my configuration steps and douts.

Context: CLIENT1 & CLIENT2 starts ssh to SERVER1 (user usr1)
(CLIENTS and SERVER both hp-ux o.s.)
CLIENT1 (user cl1)
I note already defined $HOME/.ssh directory and the file known_hosts (NOTE this file is different from known_hosts in CLIENT2 ... Is this correct?)
on clients I have executed:
1) ssh-keygen -t rsa
pressing enter for passphrase request
2) scp /.ssh/id_rsa.pub usr1@SERVER1:/id_rsa.pub
(I need to enter the password of the remote user)
SERVER1
1) chmod 700 .ssh
2) cat id_rsa.pub >> .ssh/authorized_keys
3) rm id_rsa.pub
4) chmod 600 .ssh/authorized_keys

TEST: on the CLIENT1
ssh usr1@ ls

the message received is:
usr1@'s password:

Any help well be well accepted.
Thanks in advance.

Giovanni


Geoff Wild
Honored Contributor

Re: ssh without password

What is the permisson of the home directory?

Has to be 755 or lower.

You need to add the ket in id_rsa.pub from client1 to the authorized_keys file on client2 and vice versa.

No need to remove id_rsa.pub.

Also, no need to do a ssh -l

Should just be

ssh host command

Or if from root, then:

su - user -c "ssh host command"

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Steven E. Protter
Exalted Contributor

Re: ssh without password

Shalom,

Between two systems:

System 1
ssh-keygen -t dsa


System 2
ssh-keygen -t dsa


System 1.

scp -p /username/.ssh/id_dsa.pub system2:/username/.ssh/authorized_keys

System 2

scp -p /username/.ssh/id_dsa.pub system1:/username/.ssh/authorized_keys

Want to know whats really going on?

http://www.hpuxconsulting.com/5003.ppt
or
http://www.hpuxconsulting.com/5004.ppt

They're both pretty useful.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Christian Tremblay
Trusted Contributor

Re: ssh without password

1- to help debugging, use ssh -vvv (maximum verbose)

2 check the /opt/ssh/etc/sshd_config file for correct parameters, in particular:

AuthorizedKeysFile .ssh/authorized_keys
has to point to the user's $HOME/.ssh directory to use a different key for each user.

Chris
networking
New Member

Re: ssh without password

First of all, many thanks for the support.

Waiting for a set-up of /opt/ssh/etc/sshd_config ssh file (I do not have at the moment the permissions) for the AuthorizedKeysFile paramether, I ask you if it is correct that I find set only these parameters:

Protocol 2
KerberosAuthentication yes
UsePAM yes
X11Forwarding yes
X11UseLocalhost no
Subsystem sftp /opt/ssh/libexec/sftp-server

Thanks in advance.

Giovanni
networking
New Member

Re: ssh without password

Hi,
my doubt ...
I find the file known_hosts ONLY on .ssh directory of the server where I need to run the ssh command. Is it correct?
Bye.
Giovanni