- Auto login with ssh

PDA

View Full Version : Auto login with ssh


Ivan
07-24-2004, 09:53 PM
Hi all,

I am now working with two servers which has to be synchronized with
each other. I want to use the rsync function and do the
synchronization over SSH.

But it seems to me that I cannot login to the other machine
automatically, everytime it prompts me for a password. My goal is that
the primary server can automatically login the backup server and
transfer files to the back up server by SSH so that synchronization
can be done.

I have read quite a number of web pages teaching how to use RSA key to
configure the SSH, but it really seems not working fine.

Thanks for everyone who can give me some advice.

Ivan

P.S. the primary server is running with Redhat 8.0 while the backup
server is running with Redhat 7.3, they are connected via a crossover
cable.

Markus Hosch
07-24-2004, 09:53 PM
Ivan wrote:
> Hi all,
>
> I am now working with two servers which has to be synchronized with
> each other. I want to use the rsync function and do the
> synchronization over SSH.
> [snip]
> I have read quite a number of web pages teaching how to use RSA key to
> configure the SSH, but it really seems not working fine.
>
> Thanks for everyone who can give me some advice.

Ok, here it goes:

generate a key by issuing

ssh-keygen -t <desired-type> -b <bits> see man ssh-keygen

now you have two files, one with the private key and one which contains
the public key. It's called .ssh/id_rsa.pub or id_dsa.pub . This is the
key you have to transfer to the server (e.g. via scp) and add ith to the
file .ssh/authorized_keys. Be sure that this file is only rwx by the
user and no one else. Now you should be able to log on via public key
authorization. And don't specify a passphrase for your private key ;)

Greets
Markus

Stuart H
07-24-2004, 09:53 PM
On Thu, 09 Oct 2003 02:29:46 -0700, Ivan wrote:

> Hi all,
>
> I am now working with two servers which has to be synchronized with
> each other. I want to use the rsync function and do the
> synchronization over SSH.
>
> But it seems to me that I cannot login to the other machine
> automatically, everytime it prompts me for a password. My goal is that
> the primary server can automatically login the backup server and
> transfer files to the back up server by SSH so that synchronization
> can be done.
>
> I have read quite a number of web pages teaching how to use RSA key to
> configure the SSH, but it really seems not working fine.
>
> Thanks for everyone who can give me some advice.
>
> Ivan
>
> P.S. the primary server is running with Redhat 8.0 while the backup
> server is running with Redhat 7.3, they are connected via a crossover
> cable.

http://people.enginesofcreation.ie/mick/archives/000230.html

Mattias Honrendgard
07-24-2004, 09:54 PM
tsang_ivan@hotmail.com (Ivan) wrote in message news:<4b5da7b5.0310090129.b9a466a@posting.google.com>...
> Hi all,
[snip]
>
> I have read quite a number of web pages teaching how to use RSA key to
> configure the SSH, but it really seems not working fine.
>

http://nick.luckcuck.org.uk/docs/linux-ssh-RSA-authentication-simple-HOWTO.html

Perhaps if you could explain exactly what steps you are taking, we can
be of greater help?

Ivan
07-24-2004, 09:54 PM
comeand@kissmyfatarse.com (Mattias Honrendgard) wrote in message news:<dd394218.0310091405.62a5f4a8@posting.google.com>...
> tsang_ivan@hotmail.com (Ivan) wrote in message news:<4b5da7b5.0310090129.b9a466a@posting.google.com>...
> > Hi all,
> [snip]
> >
> > I have read quite a number of web pages teaching how to use RSA key to
> > configure the SSH, but it really seems not working fine.
> >
>
> http://nick.luckcuck.org.uk/docs/linux-ssh-RSA-authentication-simple-HOWTO.html
>
> Perhaps if you could explain exactly what steps you are taking, we can
> be of greater help?


I have followed most of the instructions of some web site teaching
this topic but still failed to achieve what I want.

What I have done is as follow:
1. in local: generate key pair by "ssh-keygen -t rsa1",
2. transfer the identity.pub to the server
3. append the identity.pub to authorized_key file in the server
4. change the permission of authorized_key to 644

then when I ssh to the remote from local host, it requires me to enter
password which is not what I want.

Then I modified the /etc/ssh/sshd_config file in the server by
changing as:
PasswordAuthenticatin no

but when I ssh to the remote from local host again, it said"
Permission denied: (publickey, keyboard-interactive)

what else should I do to login without password prompt?

Thx

Ivan

Walter Schiessberg
07-24-2004, 09:54 PM
Ivan wrote on 10.10.2003 05:32:


[SSH problems]
> I have followed most of the instructions of some web site teaching
> this topic but still failed to achieve what I want.
>
> What I have done is as follow:
> 1. in local: generate key pair by "ssh-keygen -t rsa1",
> 2. transfer the identity.pub to the server
> 3. append the identity.pub to authorized_key file in the server
> 4. change the permission of authorized_key to 644
>
> then when I ssh to the remote from local host, it requires me to enter
> password which is not what I want.
>

You shure you using RSA authentication?
Try generating the DSA key.
See <http://vh224401.truman.edu/~dbindner/guide/a1903.html>
And make also shure that the .ssh directory is set to 700.

Cheers

Walter

Neil Horman
07-24-2004, 09:54 PM
Ivan wrote:
> comeand@kissmyfatarse.com (Mattias Honrendgard) wrote in message news:<dd394218.0310091405.62a5f4a8@posting.google.com>...
>
>>tsang_ivan@hotmail.com (Ivan) wrote in message news:<4b5da7b5.0310090129.b9a466a@posting.google.com>...
>>
>>>Hi all,
>>
>> [snip]
>>
>>>I have read quite a number of web pages teaching how to use RSA key to
>>>configure the SSH, but it really seems not working fine.
>>>
>>
>>http://nick.luckcuck.org.uk/docs/linux-ssh-RSA-authentication-simple-HOWTO.html
>>
>>Perhaps if you could explain exactly what steps you are taking, we can
>>be of greater help?
>
>
>
> I have followed most of the instructions of some web site teaching
> this topic but still failed to achieve what I want.
>
> What I have done is as follow:
> 1. in local: generate key pair by "ssh-keygen -t rsa1",
> 2. transfer the identity.pub to the server
> 3. append the identity.pub to authorized_key file in the server
> 4. change the permission of authorized_key to 644
>
> then when I ssh to the remote from local host, it requires me to enter
> password which is not what I want.
>
> Then I modified the /etc/ssh/sshd_config file in the server by
> changing as:
> PasswordAuthenticatin no
>
> but when I ssh to the remote from local host again, it said"
> Permission denied: (publickey, keyboard-interactive)
>
> what else should I do to login without password prompt?
>
> Thx
>
> Ivan
I think what you are actually looking for is HostBasedAuthentication.
Take a look at the sshd man page or google it, and you will find
instructions on how to set this up. You also need to make sure that
when you run ssh-keygen to generate your keys, that you just press enter
whenever it prompts you to enter a password. If you don't, ssh will
prompt you to enter it regardless of your configuration.

HTH
Neil

--
/***************************************************
*Neil Horman
*Software Engineer
*Red Hat, Inc., www.redhat.com
*gpg keyid: 1024D / 0x92A74FA1
*http://www.keyserver.net
***************************************************/

Mattias Honrendgard
07-24-2004, 09:55 PM
tsang_ivan@hotmail.com (Ivan) wrote in message news:<4b5da7b5.0310091932.5c14c7f9@posting.google.com>...
> comeand@kissmyfatarse.com (Mattias Honrendgard) wrote in message news:<dd394218.0310091405.62a5f4a8@posting.google.com>...
> > tsang_ivan@hotmail.com (Ivan) wrote in message news:<4b5da7b5.0310090129.b9a466a@posting.google.com>...
> > > Hi all,
> [snip]
> > >
> > > I have read quite a number of web pages teaching how to use RSA key to
> > > configure the SSH, but it really seems not working fine.
> > >
> >
> > http://nick.luckcuck.org.uk/docs/linux-ssh-RSA-authentication-simple-HOWTO.html
> >
> > Perhaps if you could explain exactly what steps you are taking, we can
> > be of greater help?
>
>
> I have followed most of the instructions of some web site teaching
> this topic but still failed to achieve what I want.
>
> What I have done is as follow:
> 1. in local: generate key pair by "ssh-keygen -t rsa1",
> 2. transfer the identity.pub to the server
> 3. append the identity.pub to authorized_key file in the server
> 4. change the permission of authorized_key to 644
>
> then when I ssh to the remote from local host, it requires me to enter
> password which is not what I want.
>
> Then I modified the /etc/ssh/sshd_config file in the server by
> changing as:
> PasswordAuthenticatin no
>
> but when I ssh to the remote from local host again, it said"
> Permission denied: (publickey, keyboard-interactive)
>
> what else should I do to login without password prompt?

Well, straight off the filenames look funny. Thats the one thing that
tends to get me when I haven't set up auto login with ssh for a while
- is it authorized_keys or authorised_keys2 for rsa? ;) Either way you
don't have the "s" on the end.

Found a much better walk through:

http://ist.uwaterloo.ca/~swball/sshkeys.html