Results 1 to 7 of 7

Thread: Can only connect to ubuntu server via SSH when logged in

  1. #1
    Join Date
    Oct 2009
    Beans
    1

    Can only connect to ubuntu server via SSH when logged in

    I got ubuntu server 9.04 installed on a headless machine and can successfully establish an ssh connection between my macbook and the server when I'm logged in on the server. I'm using private-, publickey to establish the connection and no passphrase and no passwords.

    Although when I reboot the server and do not log in first (I don't want to because everytime i've to connect keyboard and monitor), I can't connect via SSH. It gives me the following reason:

    Ubuntu 9.04
    Permission denied (publickey).


    Anyone an idea? If you need more information please ask.

    P.S. Funny thing is that when I first connect my macbook via an afp-connection to the server, it is possible to ssh into the server without logging in first.

  2. #2
    Join Date
    Jun 2009
    Location
    Dublin, IRL
    Beans
    130
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Can only connect to ubuntu server via SSH when logged in

    I had the same problem recently. It used to work for me, I could reboot the server and get in again only using my public key. I had to re-enable password authentication as a solution to the problem for now until I find why it happens. If I have an up-date I'll post it.

  3. #3
    Join Date
    Jun 2009
    Location
    0000:0400
    Beans
    Hidden!

    Re: Can only connect to ubuntu server via SSH when logged in

    Eek, double post.
    Last edited by falconindy; November 15th, 2009 at 08:05 PM.

  4. #4
    Join Date
    Jun 2009
    Location
    0000:0400
    Beans
    Hidden!

    Re: Can only connect to ubuntu server via SSH when logged in

    You'll need to specify a "universal" authorized_keys file in /etc/ssh/sshd_config with the AuthorizedKeysFile option. Without specifying this, the keyfile is '$HOME/.ssh/authorized_keys' -- something that won't work too well without a user logged in.

  5. #5
    Join Date
    Nov 2006
    Location
    Brooklyn, NY
    Beans
    118
    Distro
    Ubuntu

    Re: Can only connect to ubuntu server via SSH when logged in

    Quote Originally Posted by roelipot View Post
    ...because everytime i've to connect keyboard and monitor...
    This is the most interesting part for me. I have two computers at work which will not load the OS if the keyboard and mouse are not plugged in. It will just stay in the BIOS. Have you ever tried disconnecting the keyboard/mouse but leaving a monitor plugged in to the PC? You might be experiencing the same thing. Clearly, you wouldn't be able to SSh into the BIOS.
    Go the extra mile! It's Never Crowded!

  6. #6
    Join Date
    Jun 2009
    Location
    0000:0400
    Beans
    Hidden!

    Re: Can only connect to ubuntu server via SSH when logged in

    Quote Originally Posted by U2XS View Post
    This is the most interesting part for me. I have two computers at work which will not load the OS if the keyboard and mouse are not plugged in. It will just stay in the BIOS. Have you ever tried disconnecting the keyboard/mouse but leaving a monitor plugged in to the PC? You might be experiencing the same thing. Clearly, you wouldn't be able to SSh into the BIOS.
    If the server was stuck at the POST because of an error, he wouldn't be able to bounce off the IP, let alone get a permission denied response.

  7. #7
    Join Date
    Jun 2009
    Location
    Dublin, IRL
    Beans
    130
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Can only connect to ubuntu server via SSH when logged in

    I can get into my server via ssh but I 've noticed my /home/user directory is encrypted. When I try to restart ssh it tells me the "/home/user/Authorize_keys Line 27" is causing an error. This is because the /home/user directory is encrypted so the keys can't be read or found. I don't know why my /home directory is encrypted but I would say yours roelipot is encrypted too. The following command is supposed to un-encrypt the /home directory but it asks for a passphrase which I don't know.
    Code:
    sudo ecryptfs-mount-private
    I take it you can't get into your server to check. Did you choose to encrypt your /home directory when you installed the OS originally.. The /home directory doesn't un-encrypt until you log-in physically to the server, ssh doesn't count! I think this is what I did..
    You could change the location of the auth_keys file to an always un-encrypted directory to solve the problem..
    Last edited by VipX1; November 15th, 2009 at 09:23 PM. Reason: Solution, kind of..

Tags for this Thread

Bookmarks

Posting Permissions

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