![]() |
|
|||||||
| OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|||
|
Got a question regarding authentication using public key on openBSD 4.9. SSHd is on BSD and I am using a MAC OSX 5.4 to access SSHd server.
So I created a 2048 bit RSA key using ssh-keygen. I placed the .pub key on the openBSD SSHD server by using Code:
scp ~/.ssh/id_rsa.pub root@192.168.3.2: ![]() I ran chmod 600 on id_rsa.pub and moved .pub file on BSD box(I now realize I should have ran chmod 600 after moving file) Code:
mv /id_rsa.pub /etc/.ssh/authorized_keys Code:
#PasswordAuthentication yes (removed this line) PasswordAuthentication no (added this line) Code:
#publickeyauthentication yes Was able to log in using password before but now can't seem to log in. I did a good amount of research to get this far but now I am stuck. Any ideas what may be preventing me from logging in? Error is: Code:
user$ssh root@192.168.3.2 Permission denied (publickey,keyboard-interactive). Last edited by amrogers3; 11th November 2011 at 04:02 PM. Reason: corrected ssh-keygen |
|
||||
|
I don't know "key_gen" -- but whatever it is, it may require you to use it with an option in to create keys in OpenSSH format. There are other SSH servers, and OpenSSH may not be the default. Check by comparing the contents of a .pub file generated by "key_gen" with one you create using ssh-keygen(1). Different file format, or the same?
Another possibility: PermitRootLogin may be set to no. See sshd_config(5). Of course you have already done a # ls -l /root/.ssh to confirm the file is in the right place with the right permissions? Edited to add: And on the client, you've also examined $HOME/.ssh to ensure both key files are in place, with the right permissions?
__________________
OpenBSD LiveCDs/LiveDVDs Last edited by jggimi; 11th November 2011 at 03:59 PM. Reason: check client too |
|
|||
|
My apologies that should have been ssh-keygen.
Root was default set to yes. I have been using root to log in via password authentication. I'll run chmod 600 on .ssh and on .ssh/authorized_keys when I get home and report back. |
|
|||
|
I chmod 600 /etc/skel/.ssh
Also, root login is enabled. Alright, I think I found issue. Using -v: Code:
user1s-MacBook-Pro-15:~ user1$ ssh -v root@192.168.103.2 OpenSSH_5.2p1, OpenSSL 0.9.7l 28 Sep 2006 debug1: Reading configuration data /etc/ssh_config debug1: Connecting to 192.168.103.2 [192.168.103.2] port 22. debug1: Connection established. debug1: identity file /Users/user1/.ssh/identity type -1 debug1: identity file /Users/user1/.ssh/id_rsa type 1 debug1: identity file /Users/user1/.ssh/id_dsa type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.8 debug1: match: OpenSSH_5.8 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.2 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-md5 none debug1: kex: client->server aes128-ctr 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 '192.168.103.2' is known and matches the RSA host key. debug1: Found key in /Users/user1/.ssh/known_hosts:3 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,keyboard-interactive debug1: Next authentication method: publickey debug1: Trying private key: /Users/user1/.ssh/identity debug1: Offering public key: /Users/user1/.ssh/id_rsa debug1: Authentications that can continue: publickey,keyboard-interactive debug1: Trying private key: /Users/user1/.ssh/id_dsa debug1: Next authentication method: keyboard-interactive debug1: Authentications that can continue: publickey,keyboard-interactive debug1: No more authentication methods to try.
Last edited by ocicat; 12th November 2011 at 11:35 PM. Reason: Please use [code] & [/code] tags when posting command output. |
|
||||
|
I think you need -vv, or perhaps you need to look at /var/log/authlog on the host for additional information. It appears that the RSA key was offered but authentication could not be made. See two lines above your highlighting.
__________________
OpenBSD LiveCDs/LiveDVDs |
|
|||
|
Quote:
|
|
|||
|
You create the keys on the workstation that will be logging in to the server. The keys are a pair: a private one, and a public one.
The public "workstation" key has to be copied/inserted to/into the "authorized_keys" file of the account/home directory on the server. Edit: Also see Howto: Setting up public key password-less 'ssh' access
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump Last edited by J65nko; 13th November 2011 at 10:38 AM. Reason: Clarification |
|
|||
|
check and check, did that. Created keys on workstation and copied public key to server under .ssh/authorized_keys
Thanks for link, I searched for a how-to and never ran across that article. I'll check it out and see if there is something I missed. |
|
|||
|
If you want to ssh/login to the root account of the server, the public key has to be in the "root's" home directory. On most systems this will be "/root/.ssh".
You did : Quote:
Code:
mv /id_rsa.pub /root/.ssh/authorized_keys ![]() Of course, this will wipe out an already existing authorized_keysSo this is not so smart if there already is such a file.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump Last edited by J65nko; 13th November 2011 at 10:49 AM. |
|
|||
|
Quote:
So the key has to be in the home folder of the user you are trying to connect with. Got it.Okay so now I have to enter a password for the private key so I can connect. Next step is I would like to be able to connect with no password. I am not noticing the same behavior as your example: Code:
The authenticity of host '192.168.222.44 (192.168.222.44)' can't be established. RSA key fingerprint is 1a:1f:ab:96:c7:ad:1a:3f:9c:e8:2d:73:0f:28:98:07. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.222.44' (RSA) to the list of known hosts. j65nko@192.168.222.44's password: ....... Code:
$ssh root@192.168.1.2 |
|
|||
|
You will not be asked for a passphrase if you don't specify one during the ssh-keygen dialogue.
Please read Generate public and private RSA key pair with 'ssh-keygen' how to generate a key without being prompted for this passphrase.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump Last edited by J65nko; 13th November 2011 at 10:41 PM. |
|
|||
|
Quote:
Again, thank you very much! ![]() ![]()
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ncurses & function keys | JimC | OpenBSD General | 1 | 24th October 2011 02:36 PM |
| NTLM Authentication | plexter | FreeBSD Security | 1 | 7th January 2011 07:43 PM |
| Creative uses for SSH and SSH keys | backrow | Off-Topic | 1 | 21st June 2010 01:09 AM |
| Generating keys from radio echoes | J65nko | News | 0 | 4th March 2010 05:37 PM |
| arrow keys in X | idefix | FreeBSD General | 8 | 25th September 2009 08:16 AM |