Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sat Nov 27, 2010 3:06 pm 
Offline
Junior Member

Joined: Sun Sep 26, 2010 6:12 am
Posts: 20
AOL: 36+Peterborough+Road
Location: Southampton, UK
Hey guys,

I've followed the security guide in the library and locked down my server to only allow access with SSH keys. Unfortunately due to me messing about, I now can't log in via SSH and get the message "Permission denied (publickey)."

I've generated a new local key and tried to upload it to the server but got the Permission denied message again.

Any ideas?

Cheers,
Terry


Top
   
 Post subject:
PostPosted: Sat Nov 27, 2010 3:53 pm 
Offline
Senior Member

Joined: Sun May 23, 2010 1:57 pm
Posts: 315
Website: http://www.jebblue.net
The .pub version of the key needs to have its contents entered in your server's /home/<user>/.ssh/authorized_keys file.


Top
   
 Post subject:
PostPosted: Sat Nov 27, 2010 3:55 pm 
Offline
Junior Member

Joined: Sun Sep 26, 2010 6:12 am
Posts: 20
AOL: 36+Peterborough+Road
Location: Southampton, UK
Can I just copy and paste it? I'm trying to upload the key via SCP but that's failing.


Top
   
 Post subject:
PostPosted: Sat Nov 27, 2010 4:40 pm 
Offline
Senior Member

Joined: Sun May 23, 2010 1:57 pm
Posts: 315
Website: http://www.jebblue.net
You should be able to use Lish, get an ssh session then edit the authorized_keys file with like vi or nano. It works for me. Then you should be able to ssh into your server as normal.

So cat the contents of *.pub then edit it into your authorized_keys over Lish or maybe the AJAX console since you can't log into your server normally until you get this fixed.


Top
   
 Post subject:
PostPosted: Sat Nov 27, 2010 6:03 pm 
Offline
Junior Member

Joined: Sun Sep 26, 2010 6:12 am
Posts: 20
AOL: 36+Peterborough+Road
Location: Southampton, UK
Nope, no joy. Copy and pasted the key across but still can't log in :(


Top
   
 Post subject:
PostPosted: Sat Nov 27, 2010 7:29 pm 
Offline
Senior Member

Joined: Sun May 23, 2010 1:57 pm
Posts: 315
Website: http://www.jebblue.net
Did you add an AllowUsers line to /etc/ssh/sshd_config ut forgot to add your account? Check /var/log/auth.log and messages.log for clues.

Make sure you are using the correct remote user:

ssh user@host

Also add the -v to get more information.

Make sure your /home/<user>/.ssh directory has proper permissions, 600 should be fine. Perhaps 640.

If you generated the keys on a Windows client using Cygwin in a bash shell, make sure the key files private and public are at 600 too.


Top
   
 Post subject:
PostPosted: Sun Nov 28, 2010 6:41 am 
Offline
Junior Member

Joined: Sun Sep 26, 2010 6:12 am
Posts: 20
AOL: 36+Peterborough+Road
Location: Southampton, UK
Sorted now - I didn't realise I needed to restart ssh after editing the config :oops:

Thanks for your help though :)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group