Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SSH keys #4

Open
clue opened this issue May 30, 2014 · 3 comments
Open

Support SSH keys #4

clue opened this issue May 30, 2014 · 3 comments

Comments

@clue
Copy link
Owner

clue commented May 30, 2014

No description provided.

@nfarrar
Copy link

nfarrar commented May 14, 2015

I think this is directly related to one of my questions from clue/docker-phpvirtualbox#5 (starting without user intervention). I did a little googling and found this:

RUN mkdir -p /root/.ssh
ADD url_for_id_rsa /root/.ssh/id_rsa
RUN chmod 700 /root/.ssh/id_rsa
RUN echo "Host github.com\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config

I"m not sure that will actually work, but maybe? Since it's common practice to setup a vbox user to run virtualbox with phpvirtualbox, perhaps adapt it to:

RUN mkdir -p /home/vbox/.ssh
ADD url_for_id_rsa /home/vbox/.ssh/id_rsa
RUN chmod 700 /home/vbox/.ssh/id_rsa
RUN echo "Host *\n\tStrictHostKeyChecking no\n" >> /home/vbox/.ssh/config

I did a little playing around to see if I map in the vbox's user's .ssh directory as a volume as a workaround:

su vbox
ssh-keygen
ssh-copy-id localhost
echo "Host *\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config

Then I attempted to startup the container mapping /home/vbox/.ssh to /home/.ssh as a volume:

sudo docker run -it -v /home/vbox/.ssh:/home/.ssh ubuntu:14.04 /bin/bash

And the vbox .ssh directory is present at /home/.ssh:

root@56176f3ae6e1:/# ls -la /home/.ssh
total 28
drwx------ 2 1002  125 4096 May 14 03:21 .
drwxr-xr-x 3 root root 4096 May 14 03:43 ..
-rw------- 1 1002  125  395 May 14 03:20 authorized_keys
-rw-r--r-- 1 1002  125   37 May 14 03:21 config
-rw------- 1 1002  125 1679 May 14 03:15 id_rsa
-rw------- 1 1002  125  395 May 14 03:15 id_rsa.pub
-rw-r--r-- 1 1002  125  222 May 14 03:16 known_hosts

So I shut that down, and started up vboxwebsrv with:

HOSTIP=`ip -4 addr show scope global dev eth0 | grep inet | awk '{print \$2}' | cut -d / -f 1`
sudo docker run -it --name=vboxwebsrv -v /home/vbox/.ssh:/home/.ssh clue/vboxwebsrv vbox@$HOSTIP

... but I'm still getting prompted for a password.

@jwalton
Copy link

jwalton commented Jul 23, 2015

+1

@vegsag
Copy link

vegsag commented Jun 6, 2017

Look at my pullrequest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants