Operating System - HP-UX
1832343 Members
2610 Online
110041 Solutions
New Discussion

Re: ssh- public key authentication

 
ManojKumar
Advisor

ssh- public key authentication

Hi all,

I was trying public key authentication .
Client is a window' machine .
Server is a linux system .
From my window' machine(Client), i can easily execute the commands present on the server by using ssh root@ipAddr, but everytime i m supposed to provide the password .

I tried the mechanism for public key authentication but it is not working .

here, i am writing the commands one by one---
(Client machine)

1. c:\>ssh-keygen -t rsa
2. empty for filename-(default)
3. empty for passphrase key
4. pscp to copy the id_rsa to /.ssh/authorozed_keys

that' all from my side

regards,
manoj
8 REPLIES 8
TwoProc
Honored Contributor

Re: ssh- public key authentication

you need to put the id_rsa.pub file over to .ssh/authorized_keys on the other box. The "pub" file is the correct one to copy, not the main key file.
We are the people our parents warned us about --Jimmy Buffett
HGN
Honored Contributor

Re: ssh- public key authentication

Hi

The file generated should be brought over to the server where the user is going to login

under the user's home directory
under .ssh directory
file name should be authorized_keys.

Rgds

HGN
ManojKumar
Advisor

Re: ssh- public key authentication

Hi,

actually, i m using pscp to copy the file id_rsa from my window' machine to the server(linux machine) and then i m redirecting the file id_rsa on the server to /.ssh/authorized_keys by using-

cat id_rsa.pub >> /.ssh/authorized_keys .

After this i m changing the permissions-

i.e. chmod 600 /.ssh/authorized_keys

That' what i m doing .
I m not able to locate the problem .

regards,
manoj
Rajeev  Shukla
Honored Contributor

Re: ssh- public key authentication

I suggest you use putty key generator software to generate the public and the private keys. After you have done it save the private key on your windows machine and cut and paste the public key you get into authorized_keys file in the home directory or the user/.ssh
I am using this methord and works well for me. Let me know if you need more details in downloading the software and generating the key pair.
Senthil Prabu.S_1
Trusted Contributor

Re: ssh- public key authentication

Hi,
If is between windows and unix, putty is a better tool to use.

To understand clearily about SSH public key authentication between two nodes, refer this attached doc.


HTH,
Prabu.S
One man's "magic" is another man's engineering. "Supernatural" is a null word.
ManojKumar
Advisor

Re: ssh- public key authentication

Hi Rajeev,

Now, it is working for me---

When i am entering as a root user- it is not asking for a password .

Just want to know one more thing- in the root directory --we have one more directory (commands)- in this directory some commands are present .
In order to execute the comaands , we are supposed to provide the password .

we can directly enter in that directory by using ssh commands@ipAddr -- and after providing the password , we can easily execute the commands .

Due to Public Key Authentication, it is not asking for password when i m entering as a root user---but it is asking for a password in case of some other directory .--

What i want to know is --can we apply the same logic to this directory also .
What formalities i m supposed to do in order to get a password -less login .

regards,
Manoj

Arunvijai_4
Honored Contributor

Re: ssh- public key authentication

Hi Manoj,

Check these links for more information,

http://cfm.gs.washington.edu/security/ssh/client-pkauth/
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=996527

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Rajeev  Shukla
Honored Contributor

Re: ssh- public key authentication

Hi Manoj,
I am a bit confused about your setup.
Now the way ssh works is that yoy place the authorized_keys files in the $HOMEorUser/.ssh directory and that way you'll be able to run any commands from any directory that that user has access to.

Now when you say you run the command from a command directory by ssh command@ip-add i dont know how that works..
Usually if you want to run something from a server you do
ssh "command with full path"

And if you want to do this for other users you place a similar file in the home directory of that user "authorized_keys"

Am i confusing you any further or have i not understood what you want to ask?

Cheers
Rajeev