1829494 Members
1500 Online
109991 Solutions
New Discussion

Re: Paswordless SSH

 
SOLVED
Go to solution
Leovino A. Trinidad, Jr
Frequent Advisor

Paswordless SSH

Hi! Can you please help me setup a passwordless ssh in Redhat? I had already followed the other howtos on the net but failed to work... the password still keeped on prompting.

Regards,

LAT
8 REPLIES 8
Andrew Cowan
Honored Contributor
Solution

Re: Paswordless SSH

By passwordless I think you mean using keys to validate your identity instead of passwords? I'm also assuming that you are going from one HP-UX system to another?

The first thing to do is to examine the settings in the ssh_config and sshd_config files.

Examine these settings in /etc/sshd_config:
"Protocol 2"
This should be 2 only as v1 is less secure, however if you are using a pc-client that only uses version 1, this will not work.

"# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key"
Ensure these files exist and have permissions root.system/600
Older versions have an option to allow root to login, however these days the default is NO so if it not mentioned assume that you cannot login directly as root. The idea is that you login as your normal user then su!

Examine these settings in /etc/ssh_config:
"IdentityFile ~/.ssh/identity
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/id_dsa"
These files refer to ones that are created in the home directory of each user that attempts to use SSH. They are created when you first start SSH and the directory must belong to the user and have perms 700 or 750. The other files that are in your home directory

-rw-r----- authorized_keys2
-rw------- id_dsa
-rw-r----- id_dsa.pub
-rw-r--r-- known_hosts

Note. If you don't have id_dsa* files or id_rsa* files its because you haven't created a key pair yet. To create your keys run:
ssh-keygen -t [rsa|dsa]
This should create an id_[d|r]sa and id_[d|r]sa.pub files. It is very important that the permissions of these files are as above or SSH will not use them. You may have guessed that the .pub is your public key, and the other is the private key.

Now copy the ".pub" file to your target system as follows: scp ./.id_rsa.pub target:/tmp/id_dsa.pub
You will be prompted for your password on the remote system!

After the file has been copied run "ssh target" to login to the other system. Remember that you should have the same user account on both systems (eg. user andrew) or you have to make some slight adjustments.

Now cd to .ssh on the target system (create it if required) and run: cat /tmp/id_dsa.pub >> authorized_keys2 (If you are English note the mis-spelling of authorised!).

Now double-check the permissions as before and that sshd is running. Then logout of the remote system and return to you local machine and run: ssh remote
If the system still fails to login using keys try generating another key-pair using the other type. Eg if you used "dsa" last time use "rsa" and repeat the above steps but copy the public key to "authorised_keys" and see if this works.

Finally run your "ssh" with the "-v" option and paste the result in your reply.

Good luck,
Andrew
Andrew Cowan
Honored Contributor

Re: Paswordless SSH

By passwordless I think you mean using keys to validate your identity instead of passwords? I'm also assuming that you are going from one HP-UX system to another?

The first thing to do is to examine the settings in the ssh_config and sshd_config files.

Examine these settings in /etc/sshd_config:
"Protocol 2"
This should be 2 only as v1 is less secure, however if you are using a pc-client that only uses version 1, this will not work.

"# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key"
Ensure these files exist and have permissions root.system/600
Older versions have an option to allow root to login, however these days the default is NO so if it not mentioned assume that you cannot login directly as root. The idea is that you login as your normal user then su!

Examine these settings in /etc/ssh_config:
"IdentityFile ~/.ssh/identity
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/id_dsa"
These files refer to ones that are created in the home directory of each user that attempts to use SSH. They are created when you first start SSH and the directory must belong to the user and have perms 700 or 750. The other files that are in your home directory

-rw-r----- authorized_keys2
-rw------- id_dsa
-rw-r----- id_dsa.pub
-rw-r--r-- known_hosts

Note. If you don't have id_dsa* files or id_rsa* files its because you haven't created a key pair yet. To create your keys run:
ssh-keygen -t [rsa|dsa]
This should create an id_[d|r]sa and id_[d|r]sa.pub files. It is very important that the permissions of these files are as above or SSH will not use them. You may have guessed that the .pub is your public key, and the other is the private key.

Now copy the ".pub" file to your target system as follows: scp ./.id_rsa.pub target:/tmp/id_dsa.pub
You will be prompted for your password on the remote system!

After the file has been copied run "ssh target" to login to the other system. Remember that you should have the same user account on both systems (eg. user andrew) or you have to make some slight adjustments.

Now cd to .ssh on the target system (create it if required) and run: cat /tmp/id_dsa.pub >> authorized_keys2 (If you are English note the mis-spelling of authorised!).

Now double-check the permissions as before and that sshd is running. Then logout of the remote system and return to you local machine and run: ssh remote
If the system still fails to login using keys try generating another key-pair using the other type. Eg if you used "dsa" last time use "rsa" and repeat the above steps but copy the public key to "authorised_keys" and see if this works.

Finally run your "ssh" with the "-v" option and paste the result in your reply.

Good luck,
Andrew
Andrew Cowan
Honored Contributor

Re: Paswordless SSH

By passwordless I think you mean using keys to validate your identity instead of passwords? I'm also assuming that you are going from one HP-UX system to another?

The first thing to do is to examine the settings in the ssh_config and sshd_config files.

Examine these settings in /etc/sshd_config:
"Protocol 2"
This should be 2 only as v1 is less secure, however if you are using a pc-client that only uses version 1, this will not work.

"# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key"
Ensure these files exist and have permissions root.system/600
Older versions have an option to allow root to login, however these days the default is NO so if it not mentioned assume that you cannot login directly as root. The idea is that you login as your normal user then su!

Examine these settings in /etc/ssh_config:
"IdentityFile ~/.ssh/identity
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/id_dsa"
These files refer to ones that are created in the home directory of each user that attempts to use SSH. They are created when you first start SSH and the directory must belong to the user and have perms 700 or 750. The other files that are in your home directory

-rw-r----- authorized_keys2
-rw------- id_dsa
-rw-r----- id_dsa.pub
-rw-r--r-- known_hosts

Note. If you don't have id_dsa* files or id_rsa* files its because you haven't created a key pair yet. To create your keys run:
ssh-keygen -t [rsa|dsa]
This should create an id_[d|r]sa and id_[d|r]sa.pub files. It is very important that the permissions of these files are as above or SSH will not use them. You may have guessed that the .pub is your public key, and the other is the private key.

Now copy the ".pub" file to your target system as follows: scp ./.id_rsa.pub target:/tmp/id_dsa.pub
You will be prompted for your password on the remote system!

After the file has been copied run "ssh target" to login to the other system. Remember that you should have the same user account on both systems (eg. user andrew) or you have to make some slight adjustments.

Now cd to .ssh on the target system (create it if required) and run: cat /tmp/id_dsa.pub >> authorized_keys2 (If you are English note the mis-spelling of authorised!).

Now double-check the permissions as before and that sshd is running. Then logout of the remote system and return to you local machine and run: ssh remote
If the system still fails to login using keys try generating another key-pair using the other type. Eg if you used "dsa" last time use "rsa" and repeat the above steps but copy the public key to "authorised_keys" and see if this works.

Finally run your "ssh" with the "-v" option and paste the result in your reply.

Good luck,
Andrew
Andrew Cowan
Honored Contributor

Re: Paswordless SSH

By passwordless I think you mean using keys to validate your identity instead of passwords? I'm also assuming that you are going from one HP-UX system to another?

The first thing to do is to examine the settings in the ssh_config and sshd_config files.

Examine these settings in /etc/sshd_config:
"Protocol 2"
This should be 2 only as v1 is less secure, however if you are using a pc-client that only uses version 1, this will not work.

"# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key"
Ensure these files exist and have permissions root.system/600
Older versions have an option to allow root to login, however these days the default is NO so if it not mentioned assume that you cannot login directly as root. The idea is that you login as your normal user then su!

Examine these settings in /etc/ssh_config:
"IdentityFile ~/.ssh/identity
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/id_dsa"
These files refer to ones that are created in the home directory of each user that attempts to use SSH. They are created when you first start SSH and the directory must belong to the user and have perms 700 or 750. The other files that are in your home directory

-rw-r----- authorized_keys2
-rw------- id_dsa
-rw-r----- id_dsa.pub
-rw-r--r-- known_hosts

Note. If you don't have id_dsa* files or id_rsa* files its because you haven't created a key pair yet. To create your keys run:
ssh-keygen -t [rsa|dsa]
This should create an id_[d|r]sa and id_[d|r]sa.pub files. It is very important that the permissions of these files are as above or SSH will not use them. You may have guessed that the .pub is your public key, and the other is the private key.

Now copy the ".pub" file to your target system as follows: scp ./.id_rsa.pub target:/tmp/id_dsa.pub
You will be prompted for your password on the remote system!

After the file has been copied run "ssh target" to login to the other system. Remember that you should have the same user account on both systems (eg. user andrew) or you have to make some slight adjustments.

Now cd to .ssh on the target system (create it if required) and run: cat /tmp/id_dsa.pub >> authorized_keys2 (If you are English note the mis-spelling of authorised!).

Now double-check the permissions as before and that sshd is running. Then logout of the remote system and return to you local machine and run: ssh remote
If the system still fails to login using keys try generating another key-pair using the other type. Eg if you used "dsa" last time use "rsa" and repeat the above steps but copy the public key to "authorised_keys" and see if this works.

Finally run your "ssh" with the "-v" option and paste the result in your reply.

Good luck,
Andrew
Andrew Cowan
Honored Contributor

Re: Paswordless SSH

By passwordless I think you mean using keys to validate your identity instead of passwords? I'm also assuming that you are going from one HP-UX system to another?

The first thing to do is to examine the settings in the ssh_config and sshd_config files.

Examine these settings in /etc/sshd_config:
"Protocol 2"
This should be 2 only as v1 is less secure, however if you are using a pc-client that only uses version 1, this will not work.

"# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key"
Ensure these files exist and have permissions root.system/600
Older versions have an option to allow root to login, however these days the default is NO so if it not mentioned assume that you cannot login directly as root. The idea is that you login as your normal user then su!

Examine these settings in /etc/ssh_config:
"IdentityFile ~/.ssh/identity
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/id_dsa"
These files refer to ones that are created in the home directory of each user that attempts to use SSH. They are created when you first start SSH and the directory must belong to the user and have perms 700 or 750. The other files that are in your home directory

-rw-r----- authorized_keys2
-rw------- id_dsa
-rw-r----- id_dsa.pub
-rw-r--r-- known_hosts

Note. If you don't have id_dsa* files or id_rsa* files its because you haven't created a key pair yet. To create your keys run:
ssh-keygen -t [rsa|dsa]
This should create an id_[d|r]sa and id_[d|r]sa.pub files. It is very important that the permissions of these files are as above or SSH will not use them. You may have guessed that the .pub is your public key, and the other is the private key.

Now copy the ".pub" file to your target system as follows: scp ./.id_rsa.pub target:/tmp/id_dsa.pub
You will be prompted for your password on the remote system!

After the file has been copied run "ssh target" to login to the other system. Remember that you should have the same user account on both systems (eg. user andrew) or you have to make some slight adjustments.

Now cd to .ssh on the target system (create it if required) and run: cat /tmp/id_dsa.pub >> authorized_keys2 (If you are English note the mis-spelling of authorised!).

Now double-check the permissions as before and that sshd is running. Then logout of the remote system and return to you local machine and run: ssh remote
If the system still fails to login using keys try generating another key-pair using the other type. Eg if you used "dsa" last time use "rsa" and repeat the above steps but copy the public key to "authorised_keys" and see if this works.

Finally run your "ssh" with the "-v" option and paste the result in your reply.

Good luck,
Andrew
Andrew Cowan
Honored Contributor

Re: Paswordless SSH

By passwordless I think you mean using keys to validate your identity instead of passwords? I'm also assuming that you are going from one HP-UX system to another?

The first thing to do is to examine the settings in the ssh_config and sshd_config files.

Examine these settings in /etc/sshd_config:
"Protocol 2"
This should be 2 only as v1 is less secure, however if you are using a pc-client that only uses version 1, this will not work.

"# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key"
Ensure these files exist and have permissions root.system/600
Older versions have an option to allow root to login, however these days the default is NO so if it not mentioned assume that you cannot login directly as root. The idea is that you login as your normal user then su!

Examine these settings in /etc/ssh_config:
"IdentityFile ~/.ssh/identity
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/id_dsa"
These files refer to ones that are created in the home directory of each user that attempts to use SSH. They are created when you first start SSH and the directory must belong to the user and have perms 700 or 750. The other files that are in your home directory

-rw-r----- authorized_keys2
-rw------- id_dsa
-rw-r----- id_dsa.pub
-rw-r--r-- known_hosts

Note. If you don't have id_dsa* files or id_rsa* files its because you haven't created a key pair yet. To create your keys run:
ssh-keygen -t [rsa|dsa]
This should create an id_[d|r]sa and id_[d|r]sa.pub files. It is very important that the permissions of these files are as above or SSH will not use them. You may have guessed that the .pub is your public key, and the other is the private key.

Now copy the ".pub" file to your target system as follows: scp ./.id_rsa.pub target:/tmp/id_dsa.pub
You will be prompted for your password on the remote system!

After the file has been copied run "ssh target" to login to the other system. Remember that you should have the same user account on both systems (eg. user andrew) or you have to make some slight adjustments.

Now cd to .ssh on the target system (create it if required) and run: cat /tmp/id_dsa.pub >> authorized_keys2 (If you are English note the mis-spelling of authorised!).

Now double-check the permissions as before and that sshd is running. Then logout of the remote system and return to you local machine and run: ssh remote
If the system still fails to login using keys try generating another key-pair using the other type. Eg if you used "dsa" last time use "rsa" and repeat the above steps but copy the public key to "authorised_keys" and see if this works.

Finally run your "ssh" with the "-v" option and paste the result in your reply.

Good luck,
Andrew
Caesar_3
Esteemed Contributor

Re: Paswordless SSH

Hello!

You need to have the key of the sshd on the other machine then you could connect to.
Also you need to configure the ssh

Caesar
Steven E. Protter
Exalted Contributor

Re: Paswordless SSH

In this thread:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xd95a2d88ce9cd711abdc0090277a778c,00.html

Chris Vail has a document attached which handles the whole thing, even permissions.

Its worked for me on Linux and HP-UX.

I think I have posted this doc like 100 times.

See Chris Vail's report.

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