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

SSH into boot2docker vm as root #550

Open
pheuter opened this issue Sep 25, 2014 · 7 comments

Comments

Projects
None yet
8 participants
@pheuter
Copy link

commented Sep 25, 2014

I'm trying to setup OpenSSH on boot2docker to support ssh'ing as root from OS X to enable sshfs-fuse to mount persistent docker volumes in /mnt.

Right now, I can do: $ ssh docker@boot2docker and that works just fine, but since the /mnt directory is all root, I cannot actually mount the persistent volumes.

I can configure /usr/local/etc/ssh/sshd_config to PermitRootLogin yes and PermitRootLogin without-password, but it still doesn't work because I need to create an ssh key for the root user and add my OS X public key to /root/.ssh/authorized_keys. The issue there is that /root/.ssh gets wiped out upon restarting the vm.

Any ideas / suggestions greatly appreciated.

@SvenDowideit

This comment has been minimized.

Copy link
Contributor

commented Sep 26, 2014

boot2docker/boot2docker-cli#247 contains all the steps needed to use sshfs to mount your host's dirs into the vm :)

@sindhus

This comment has been minimized.

Copy link

commented Oct 23, 2014

@SvenDowideit That doesn't answer the original question.

ssh root@localhost -p 2222 asks me a root password and am sure it's saying give me root password root@localhost inside boot2docker vm.

@SvenDowideit

This comment has been minimized.

Copy link
Contributor

commented Oct 24, 2014

no, true, it doesn't answer the direct question, because there are better ways to achieve the desired result (i hope)

@arthurlee

This comment has been minimized.

Copy link

commented Nov 28, 2015

I find a way to do that. First please login as docker user. Then create the password of the root using command 'sudo passwd root'. At the end, you can switch to root user with 'su - root'. It works in my machine.

@lifeisfoo

This comment has been minimized.

Copy link

commented Feb 7, 2016

Login via ssh as dockeruser with tcuser password. Then just run sudo su root.

@lvmodan

This comment has been minimized.

Copy link

commented Jun 24, 2017

I also can change the password of root user by 'sudo passwd root'. Is it expected? anyway, it solved my problem.

@masaeedu

This comment has been minimized.

Copy link
Contributor

commented Jan 30, 2018

I'm interested in using this to implement the docker-machine mount feature for Windows (see docker/machine#4014). The SSHFS+FUSE approach is packaged up in an SSHFS binary for Windows here.

However I'm unable to use it with the docker user since it has no access to the volume folders, and Dokan doesn't have the allow_root feature. Once I ssh in and do the sudo passwd root hack (plus enable PermitRootLogin in the sshd config), I am able to mount all remote volumes as local drives.

If the root login restriction is removed (or docker is granted access to the volumes), this can be packaged into an implementation of the docker-machine mount feature for Windows.

@wglambert wglambert added the question label Jul 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.