Search code examples
sshibm-cloud

Unable to connect using SSH to the pushed MobileFirst container image on Bluemix


I have built an MF container image and pushed it. I have copied the file in (Mac) ~/.ssh/id_rsa.pub to mfpf-server/usr/ssh before building the image.

I am trying to connect using the command in Mac terminal:

ssh -i ~/.ssh/id_rsa admin@public_ip

It says: Permission denied (publickey).

Any idea? What is the user I shall use?


Solution

  • your problem is very probably related to the permissions of the pub key copied on the container or to the configuration of your key.

    You could check the permissions of key copied on the container, sshd is really strict on permissions for the authorized_keys files: if authorized_keys is writable for anybody other than the user or can be made writable by anybody other than the user, sshd will refuse to authenticate (unless sshd is configured with StrictModes no) Moreover such a problem won't be showed using ssh -v, it will showed only on daemon logs (on the container)

    From man sshd(8):

    ~/.ssh/authorized_keys Lists the public keys (RSA/DSA) that can be used for logging in as this user. The format of this file is described above. The content of the file is not highly sensitive, but the recommended permissions are read/write for the user, and not accessible by others.

         If this file, the ~/.ssh directory, or the user's home directory
         are writable by other users, then the file could be modified or
         replaced by unauthorized users.  In this case, sshd will not
         allow it to be used unless the StrictModes option has been set to
         “no”.
    

    So I suggest you to check about the files and directories permissions. Then check that the content of your pub key has been copied correctly on authorized_keys listing

    /root/.ssh/authorized_keys