Problem - Creating SSH Public/Private keys. Please help.


 
Thread Tools Search this Thread
Operating Systems HP-UX Problem - Creating SSH Public/Private keys. Please help.
# 1  
Old 11-22-2009
Problem - Creating SSH Public/Private keys. Please help.

HI,

I'm trying to create SSH public/private keys using following command.

Code:
hp023:/users/vikram> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/users/vikram/.ssh/id_rsa): rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in rsa.
Your public key has been saved in rsa.pub.
The key fingerprint is:
2e:3f:4a:ae:4c:52:60:9r:5e:8b:fc:e6:b1:d8:9c:64 vikram@hp023

I'm having valid folder /users/vikram/.ssh/id_rsa
With 777 permission and Suffient space too.
I'm able to place any file in that directory too.

But when i issue the above mentioned command , its not at all creating the keys in that directory.

Please help me.

regards
vikram.

Last edited by pludi; 11-22-2009 at 07:58 AM.. Reason: code tags, please...
# 2  
Old 11-22-2009
Quote:
Originally Posted by vickramshetty
HI,

I'm trying to create SSH public/private keys using following command.

hp023:/users/vikram> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/users/vikram/.ssh/id_rsa): rsa

Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in rsa.
Your public key has been saved in rsa.pub.
The key fingerprint is:
2e:3f:4a:ae:4c:52:60:9r:5e:8b:fc:e6:b1:d8:9c:64
vikram@hp023

I'm having valid folder /users/vikram/.ssh/id_rsa
With 777 permission and Suffient space too.
I'm able to place any file in that directory too.

But when i issue the above mentioned command , its not at all creating the keys in that directory.

Please help me.

regards
vikram.

Quote:
The default name of the pvt key is id_rsa if no name is mentioned, it is not a directory.Understand from the output you pasted, you are having a directory with the name "id_rsa". As the directory already exists, it will not allow keygen to create afile with same name as of directory.Remove the directory id_rsa and proceed.
# 3  
Old 11-23-2009
Hi,

Thank you very much.

I deleted the folder id_rsa And successfully created the id_rsa and id_rsa.pub key

I pasted the id_rsa.pub contents in authorized_keys as well as known_hosts files in .ssh of my home directory directory of target server(user id same for both target as well as the source server)

in know_hosts i entered servername, public key contents.

but still its asking for password while using ssh or scp.

I've have doubt in the formatt and location of authorized_keys and known_hosts.
please help me.

Thanks.

Last edited by vickramshetty; 11-23-2009 at 03:32 AM.. Reason: mentioned ssh directrory path
# 4  
Old 11-23-2009
Please set the permissions of the .ssh directory and files under the directory to 640
# 5  
Old 11-23-2009
Hi dj,

Thanks for the reply.
I did everything , even i gave 640 permission to all of the objects as u said.
Still its asking for the passowrd.

i've ran scp in verbose mode.
Please have a look into it.

Code:
hp001:/dtusr1/vikram > scp -v sqlnet.log vikram@hp002.us.dt.com:/dtusr1/vikram
Executing: program /usr/local/bin/ssh host hp002.us.dt.com, user vikram, command scp -v -t /dtusr1/vikram
OpenSSH_4.0p1, OpenSSL 0.9.7f 22 Mar 2005
debug1: Reading configuration data /usr/local/etc/ssh/ssh_config
debug1: Connecting to hp002.us.dt.com [158.151.152.38] port 22.
debug1: Connection established.
debug1: identity file /dtusr1/vikram/.ssh/id_rsa type 1
debug1: identity file /dtusr1/vikram/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.0
debug1: match: OpenSSH_4.0 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.0
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'hp002.us.dt.com' is known and matches the RSA host key.
debug1: Found key in /dtusr1/vikram/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: /dtusr1/vikram/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /dtusr1/vikram/.ssh/id_dsa
debug1: Next authentication method: keyboard-interactive
Password:
debug1: Authentication succeeded (keyboard-interactive).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending command: scp -v -t /dtusr1/vikram
Sending file modes: C0644 2703 sqlnet.log
Sink: C0644 2703 sqlnet.log
sqlnet.log                                                                                                               100% 2703     2.6KB/s   00:00
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.3 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status 0

i'm not able to infer anything out of it as there are error messages. Please help me. need to bypass password .

Thanks
vikram.

Last edited by vickramshetty; 11-23-2009 at 06:08 AM..
# 6  
Old 11-23-2009
What is the ssh version?
Try appedn the public key in authorized_keys2 file also. Make sure you give 640 permission to the file.
# 7  
Old 11-23-2009
what is the permission on home directory... on both servers
Actually, some ssh implementations will fail if *any* directory in the path to the authorized keys file has group or world write permission.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Ssh public/private key user login problem

I have a user account configuration with ssh public/private key that works on multiple servers centos and rhel. One server (Server F) that is not working in centos 6.8. When i ssh into server f I get prompted for a password. I have verified the config and it all is good. I put sshd into debug... (8 Replies)
Discussion started by: bash_in_my_head
8 Replies

2. Shell Programming and Scripting

sftp using private and public keys

hi guys , i have few files i have to do sftp, the public and private key work like a magic , no problem at all the syntax is as below sftp -0 identityfile=~/ure/blsl/loc2/.ssh/id_rsa_ssh1 ssh1@remote >log_dir/file.timestamp<<end lcd folder cd folder put * quit end ================ my... (3 Replies)
Discussion started by: rockymayavia
3 Replies

3. Shell Programming and Scripting

SFTP - Private and Public keys

Hi All, I have a query....say on server A, I have generated the Private and Public keys and shared the public key with server B. Now i can surelyconnect(without password) from server A to server B..... but can i similarly connect from server B to server A as well Regards (1 Reply)
Discussion started by: Arpit Narula
1 Replies

4. Shell Programming and Scripting

Shell script for SFTP using Public and private keys

Hi all, I needed a shell script for file transfering using public/private keys for authentication. Could you please help me out on this? A procedure to write a shell script is enough. Thanks in advance. Regards. Vidya N (8 Replies)
Discussion started by: Vidya N
8 Replies

5. UNIX for Dummies Questions & Answers

how to create a public/private key using ssh-keygen

Hi, please guide me create a public/private key using ssh-keygen, lets say I have been access to server named pngpcdb1with a userid and password ...!!! and also please explain in detail the concept of these keys and ssh as I was planning to use them in ftp related scripts..! Thanks in... (1 Reply)
Discussion started by: rahul125
1 Replies

6. Shell Programming and Scripting

What are public keys in ssh and how do we create the public keys??

Hi All, I am having knowledge on some basics of ssh and wanted to know what are the public keys and how can we create and implement it in connecting server. Please provide the information for the above, it would be helpful for me. Thanks, Ravindra (1 Reply)
Discussion started by: ravi3cha
1 Replies

7. Windows & DOS: Issues & Discussions

Public/Private Key SSH from UNIX to Windows (Cygwin)

Hello all, I have a bit of trouble working a passwordless SSH from UNIX to Cygwin running windows 2k3. Here are some details. I AM able to SSH from the Windows box to the UNIX box using the keys. Also, I'm able to SSH from UNIX to Windows w/o the keys. However, when I try to do it with the keys... (9 Replies)
Discussion started by: kclerks11
9 Replies

8. UNIX for Dummies Questions & Answers

ssh public/private Keys

Hello, I have an issue with an outside party trying to deliver a file to our server via SFTP. I have setup the .ssh directory under the home directory for the user account that is being used and setup the authorized_keys file with correct permissons etc for .ssh directory and file. We... (2 Replies)
Discussion started by: richo king
2 Replies

9. UNIX for Dummies Questions & Answers

ssh public keys

Hello*! I have problems with public keys. On one side i have Solaris 10, and on other side is HP UNIX. I created public keys on Solaris with "ssh-keygen -t rsa", append id_rsa.pub key to ~user/.ssh/authorized_keys on remote machine, and tried to connect with ssh without password. But for some... (1 Reply)
Discussion started by: ghost01
1 Replies

10. UNIX for Advanced & Expert Users

SSH public and private keys

Firstly, i apologise if i have posted in a wrong section of the forum. Please let me know which is the correct section my post should go to. I have to SCP a file from one server(server A) to another (server B). I read around that a secure way is to use public and private keys. Assuming my... (2 Replies)
Discussion started by: new2ss
2 Replies
Login or Register to Ask a Question