LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   ssh "Permission denied (publickey)" (https://www.linuxquestions.org/questions/linux-server-73/ssh-permission-denied-publickey-846458/)

m4rtin 11-25-2010 04:22 AM

ssh "Permission denied (publickey)"
 
If I try to connect to 192.168.1.100 server, I get:

Code:

martin@desktop:~> ssh -v 192.168.1.100
OpenSSH_4.1p1, OpenSSL 0.9.7g 11 Apr 2005
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 192.168.1.100 [192.168.1.100] port 22.
debug1: Connection established.
debug1: identity file /home/martin/.ssh/identity type 0
debug1: identity file /home/martin/.ssh/id_rsa type 1
debug1: identity file /home/martin/.ssh/id_dsa type -1
debug1: Remote protocol version 1.99, remote software version OpenSSH_3.5p1
debug1: match: OpenSSH_3.5p1 pat OpenSSH_3.*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.1
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 '192.168.1.100' is known and matches the RSA host key.
debug1: Found key in /home/martin/.ssh/known_hosts:23
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
debug1: Next authentication method: publickey
debug1: Offering public key: /home/martin/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/martin/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).

Unfortunately, I don't manage this 192.168.1.100 server. Am I correct, that sshd on 192.168.1.100 supports only publickey authentication because:

Code:

debug1: Authentications that can continue: publickey
I have .ssh/id_rsa present. Any ideas, what might cause this "Permission denied (publickey)" issue? :rolleyes:

linuxlover.chaitanya 11-25-2010 04:24 AM

Have you generated the public and private ssh key pair for your system? If the server is configured to use public key authentication, you will need to take your public key and place it on the server on the configured location.

wpeckham 11-25-2010 06:55 AM

ssh
 
If you have no direct access to this server, you wil have to provide your public key to the SYSADM staff that HAS access and ask them to install it so that you can access the account. While there, they should check the ownership and permissions of the account home, ~/.ssh folder, and files in ~/.ssh. If the permissions are wrong, ssh will refuse the connections: but the error generated is very clear about WHY and we are not seeing that.

To answer that question: yes it does appear that the server is set to allow access by secure key only.

bindian0509 10-15-2014 03:14 AM

SSHD config needs to be changed
 
Somehow the password based authentication has been diabled on the connecting server.

Here is the deal --


Step 1 : sudo vim /etc/ssh/sshd_config

Step 2 : find PasswordAuthentication .... infront of that change 'no' to 'yes'

Step 3 : sudo service ssh restart (Restart the SSHD server)


Thats it you can now log in to this server from any machine using user passwords

simrika 10-19-2014 06:47 PM

-Enter ssh-keygen command.
-Asks where to save the keys
-Passphrase will allow you to secure the private keys.
-Keys are generated in /root/.ssh/
-id_rsa is private key
-id_rsa.pub is a public key
-Copy the public key to the next server which you want to login to your current server without password. Let's say server A to server B.
- Enter command Ssh-copy-id -i .ssh/id_rsa.pub [from server A] root @192.168.0.x[server B]
-This ssh-copy-id will take this public key location and name of public key by default

Now you will be able to login.

wpeckham 10-20-2014 05:56 AM

well duh!
 
so simrika, I take it you did not read the thread before posing?
OP cannot ssh to the server, so ssh-copy-id is not going to work either.

simrika 10-20-2014 08:30 AM

ok I think you need to have a username infront of your server's ip address. It should be ssh username@ip address.

lleb 10-20-2014 08:28 PM

Quote:

Originally Posted by m4rtin (Post 4170547)
If I try to connect to 192.168.1.100 server, I get:

[CODE]martin@desktop:~> ssh -v 192.168.1.100

This is potentially your problem right there.

1. are you on the same subnet, in other words are you in that LAN?
2. is the UID from your workstation the same UID you are attempting to connect to on the server?
3. the standard process for using ssh is as follows:
Code:

$ ssh <remote_user>@<IP>
note the REMOTE_USER you are missing. depending on the versions of sshd and openssh being used it may or may not allows you to connect without a user, this might not be displayed as a user error as it is checking for some type of authentication to match with said user.

4. are you able to successfully ssh in without using public keys?
5. have you verified the permissions on both your system and the remote systems /home/remote_user/.ssh directory and files?

read the links in my sig for further details.


All times are GMT -5. The time now is 02:17 AM.