Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2010
    Posts
    61

    SSH keys Permission denied (publickey)

    So the last time I tried to set up SSH keys I followed the tutorial here: https://help.ubuntu.com/community/SSH/OpenSSH/Keys and had it working within minutes. My client computer is on ubuntu and the host is centos 6. It's been about a year since and now I have to do it again and I'm having an issue.

    After restarting ssh and trying to login it still requests me for a password, so I turned PasswordAuthentication to no, but then I get a permission denied error for the public key. I've googled this and almost all sources state the issue is that the permissions are not set correctly on your .ssh folder and authorized_keys file. On the server my .ssh folder is 700 and the authorized_keys file is 600, but I'm still receiving this error. In my sshd_config file I have PubkeyAuthentication yes and RSAAuthentication yes. The signature in my authorized_keys matches my id_rsa.pub file. When I look in /var/log/secure it just says the connection was closed by my IP.

    The only thing difference from setting up since last time is that the user I'm trying to login as with the SSH key is root. Even though that probably may be frowned upon, it should still work shouldn't it?

    I've also tried deleting my entire ssh folder and starting again, but no luck. Anyone know what else I can try? Thanks.

  2. #2
    Join Date
    Nov 2001
    Location
    Ashburn, VA
    Posts
    1,206
    Try using debug on your ssh session to get more details.

    ssh -vv [email protected]
    Affordable web hosting, design, & domain registration services since 2001
    www.serve-you.net

  3. #3
    Join Date
    Jul 2005
    Location
    Huh... where am I again?
    Posts
    974
    Do you have anything in /etc/hosts.deny, like deny : all ? If so, in /etc/hosts.allow, put sshd : YOUR_IP : allow .
    -Steven | u2-web, LLC - Clustered Shared Hosting
    "It is the mark of an educated mind to be able to entertain a thought without accepting it" -Aristotle

  4. #4
    Join Date
    Jan 2005
    Location
    Scotland, UK
    Posts
    2,549
    If this is EL6 you might need to set selinux to allow the .ssh folder with,

    restorecon -Rv /homefolder

    Such as

    restorecon -Rv /root
    Server Management - AdminGeekZ.com
    Infrastructure Management, Web Application Performance, mySQL DBA. System Automation.
    WordPress/Magento Performance, Apache to Nginx Conversion, Varnish Implimentation, DDoS Protection, Custom Nginx Modules
    Check our wordpress varnish plugin. Contact us for quote: [email protected]

  5. #5
    Join Date
    Mar 2010
    Posts
    61
    Quote Originally Posted by Scott.Mc View Post
    If this is EL6 you might need to set selinux to allow the .ssh folder with,

    restorecon -Rv /homefolder

    Such as

    restorecon -Rv /root
    Looks like this was my problem. It works now.

    I was searching for hours and didn't see anyone mention to do that. Thank you so much Scott!

Similar Threads

  1. Replies: 3
    Last Post: 01-03-2013, 11:18 AM
  2. SSH Error: Permission denied (publickey,gssapi-with-mic)
    By Rafal_A in forum Hosting Security and Technology
    Replies: 4
    Last Post: 03-14-2012, 05:22 PM
  3. disabling SSH root access but enabling SSH keys how to do that?
    By sharmaine1111 in forum Hosting Security and Technology
    Replies: 7
    Last Post: 04-03-2009, 11:26 PM
  4. Permission denied (publickey).
    By Smurfas in forum Hosting Security and Technology
    Replies: 2
    Last Post: 05-23-2008, 09:30 AM
  5. permission denied
    By Omair Haroon in forum Dedicated Server
    Replies: 19
    Last Post: 08-16-2001, 01:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •