LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-06-2010, 07:39 AM   #1
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
ssh killing me :( Permission denied (publickey)


So I have searched and searched and followed numerous howto's but appear to be a little thick on getting this one to work
It appears no matter what settings I change I cannot ssh into my laptop on the same network (for testing).

SO, here is where I have left it:
Code:
#on laptop which I am trying to connect to
ssh-keygen -t rsa    # did start with dsa but both give the same issue
Enter passphrase: <done> and repeated successfully

#on other machine (Nokia N900) after installing ssh software
accept bluetooth transmission of id_rsa.pub
mkdir .ssh
mv id_rsa.pub .ssh/authorized_keys
chmod 700 .ssh
chmod 600 .ssh/authorized_keys

#back on laptop
sudo service ssh restart   #restart service on Ubuntu machine

#back to N900
ssh grail@10.1.1.2
<blah blah ...>add to known_hosts:(yes/no) yes
... <time goes by>
Permission denied (publickey).
At this point I would add that prior to the above, on one of my many other attempts, I did confirm that I was able to ssh with the users password, ie grail's password

Also, I have attached my sshd_config below, but would note this has been changed as a conglomeration of all the howto's I have looked at.

Any help would be greatly appreciated as I know it will be something simple

Cheers
grail

PS. let me know if I need to provide any other details?
Attached Files
File Type: log sshd_config.log (2.4 KB, 49 views)

Last edited by grail; 07-06-2010 at 07:40 AM.
 
Old 07-06-2010, 08:03 AM   #2
rical
LQ Newbie
 
Registered: Jun 2010
Posts: 13

Rep: Reputation: 1
I had a similar problem a log time ago. After reading the source code I found it that ssh expects the ~/.ssh folder to have drwxrwxr-x permission (if I remember correctly).

This doesn't make any sense at all as you don't want people poking around in there, anyway if I was you I wold at least try setting:

Code:
sudo chmod 755 ~ # This is the default in most dist
sudo chown -R `whoami`. ~/.ssh/ # This is also default
chmod -R 775 ~/.ssh
chmod 600 ~.ssh/authorized_keys
Apply this on both server and client. If it doesn't help revert back to what you where using, your permission settings make a lot more sense.

EDIT:
As I told you this make no sense and probably isn't the soultion the correct permission for .ssh is 0700 as you have set. Anyway try it. if it doesn't work. Run sshd with debug flag and check the output:
Code:
`which sshd` -d

Last edited by rical; 07-06-2010 at 08:11 AM.
 
Old 07-06-2010, 08:12 AM   #3
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Hi

I'm not sure what it could be, but try the -v option when you ssh from the laptop. You get lots of information that can help you finding the problem.
 
Old 07-06-2010, 08:43 AM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Original Poster
Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Ok ... so thanks for the information.

The 775 option made no difference

Below is attached the output of trying to ssh from the N900 to my laptop which is running Ubuntu 10.04

As you can see the result is still the same
Attached Files
File Type: log ssh.log (4.8 KB, 53 views)
 
Old 07-06-2010, 08:56 AM   #5
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Ah, I think the confusion is where you made the key.

On the phone do:
ssh-keygen -t rsa

Hit enter a couple of times.

The public key file will then be in "/home/user/.ssh/id_rsa.pub". You need to copy this file to the laptop somehow. It should then be copied or moved to "/home/grail/.ssh/authorized_keys"
 
Old 07-06-2010, 09:01 AM   #6
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Original Poster
Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
So if I understand correctly you are saying I am ssh'ing in the wrong direction?

Problem is I am not able to go the other way either, ie from laptop to phone (which I presume is the right direction based on how I created and copied key ... yes?) I receive the same message and have setup the same sshd_config on the phone.

To make sure I will attach my attempt to connect from laptop to phone.

Thank you very much for your patience
Attached Files
File Type: log ssh_laptop.log (7.0 KB, 44 views)
 
Old 07-06-2010, 09:02 AM   #7
IW2B
Member
 
Registered: Aug 2008
Location: Denmark
Distribution: Fedora, Ubuntu, Solaris
Posts: 35

Rep: Reputation: 19
Hi,

Looks like the files do not exist:

Quote:
debug1: Next authentication method: publickey
debug1: Trying private key: /home/user/.ssh/identity
debug3: no such identity: /home/user/.ssh/identity
debug1: Trying private key: /home/user/.ssh/id_rsa
debug3: no such identity: /home/user/.ssh/id_rsa
debug1: Trying private key: /home/user/.ssh/id_dsa
debug3: no such identity: /home/user/.ssh/id_dsa

From your original text you have:

Laptop: ssh-keygen -t rsa
Nokia: mv id_rsa.pub .ssh/authorized_keys
Laptop: sudo service ssh restart
Nokia: ssh grail@10.1.1.2

At no point in the above steps was a key generated on the Nokia and copied to .ssh/authorized_keys on the laptop. If your sshd on the laptop is set to not allow password authentication then you will need to create a key on the Nokia and transfer it to the Laptops authorized_keys

Ian
 
Old 07-06-2010, 09:11 AM   #8
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Original Poster
Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Hi Ian

Thanks for your feedback ... this at least proves I know was understanding Guttorm that I was going the wrong way, ie I created key on laptop and transferred
to phone so I should be able to connect to phone from the laptop (just to check this is correct based on the above steps?)

cheers
grail
 
Old 07-06-2010, 09:21 AM   #9
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Hi again

I'm confused as well. But according to the first log, when you connect from the phone to the laptop, no key is found at all. When you connect from the laptop, a key is sent to the phone, but it looks like the phone rejects it.

Are these files equal?
On the laptop: /home/grail/.ssh/id_rsa.pub
On the phone: /home/user/.ssh/authorized_keys

Also, did you remember user@phone when you ssh from the laptop?
 
Old 07-06-2010, 09:28 AM   #10
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Original Poster
Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Quote:
Also, did you remember user@phone when you ssh from the laptop?
Yep ... made this error a few times before noticing

Code:
#laptop
-rw-r--r-- 1 grail grail 396 2010-07-06 21:36 .ssh/id_rsa.pub

#phone
-rw------- 1 user  users 396   Jul   6  21:38 .ssh/authorized_keys
 
Old 07-06-2010, 10:47 AM   #11
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Original Poster
Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Ok ... I have an update

I can now go from the phone to the laptop, but still get the same message going from the laptop to the phone.

Now I realise it is unlikely I will go in this direction very often, but I figure as I have started I should get to the bottom of this.

In some of the howto's I looked at it mentioned to run ssh-add once connection was able to be made, but when tried on the phone, even though I cannot currently connect, it gives the following error (not sure if related but putting up the things I have tried)
Code:
ssh-add
Could not open a connection to your authentication agent.

#this caused me to run
ps auwx | grep ssh-agent

#to which there is no reply
To get laptop to phone to work, simply creating the key and copying to laptop and renaming in the .ssh directory seemed to work straight away

I have since re-copied from laptop to phone and renamed in .ssh directory there but am still not able to connect
 
  


Reply

Tags
ssh



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh -- Permission denied (publickey,password,keyboard-interactive). davidkline Linux - Networking 11 08-20-2014 02:19 PM
[SOLVED] SSH - Permission denied (publickey,keyboard-interactive) sarves Linux - Newbie 3 05-12-2010 12:55 AM
ssh client say me Permission denied.(publickey). linderox Linux - Networking 2 02-27-2008 09:36 AM
Permission denied (publickey,password,keyboard-interactive) cccc Linux - General 3 05-31-2007 05:32 PM
Permission denied (publickey,password,keyboard-interactive). rockymaxsource Linux - Networking 3 04-27-2007 08:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration