Accessing the macOS VM over SSH #50

Closed
opened 2025-12-28 23:22:36 +01:00 by adam · 9 comments
Owner

Originally created by @jviotti on GitHub (Jun 24, 2020).

I'm following the instructions and running the VM by port forwarding the SSH port -p 50922:10022, however I can't get a shell on the VM at localhost from the host as the connection is refused and nmap doesn't show the port being open.

Am I missing something?

Originally created by @jviotti on GitHub (Jun 24, 2020). I'm following the instructions and running the VM by port forwarding the SSH port `-p 50922:10022`, however I can't get a shell on the VM at `localhost` from the host as the connection is refused and `nmap` doesn't show the port being open. Am I missing something?
adam closed this issue 2025-12-28 23:22:36 +01:00
Author
Owner

@sickcodes commented on GitHub (Jun 24, 2020):

ssh localhost -p 50922
You also have to turn on system sharing once you've installed the OS
Its under "remote login" in OSX settings

@sickcodes commented on GitHub (Jun 24, 2020): ssh localhost -p 50922 You also have to turn on system sharing once you've installed the OS Its under "remote login" in OSX settings
Author
Owner

@jviotti commented on GitHub (Jun 25, 2020):

You also have to turn on system sharing once you've installed the OS
Its under "remote login" in OSX settings

I see. It would be nice to mention this in the docs! Thanks!

@jviotti commented on GitHub (Jun 25, 2020): > You also have to turn on system sharing once you've installed the OS Its under "remote login" in OSX settings I see. It would be nice to mention this in the docs! Thanks!
Author
Owner

@jviotti commented on GitHub (Jun 25, 2020):

I'm afraid I can't make it work yet. I enabled remote login in macOS, and I can ssh to the VM from within the VM at port 22, but 50922 never gets forwarded to the host.

@jviotti commented on GitHub (Jun 25, 2020): I'm afraid I can't make it work yet. I enabled remote login in macOS, and I can ssh to the VM *from within the VM* at port 22, but 50922 never gets forwarded to the host.
Author
Owner

@sickcodes commented on GitHub (Jun 25, 2020):

docker ps
See if you have anything else using that port

Did you copy the ports exactly as they are in the readme and/or top of the docker file?

localhost:50922 goes to container:10022 which goes to guest:22

@sickcodes commented on GitHub (Jun 25, 2020): `docker ps` See if you have anything else using that port Did you copy the ports exactly as they are in the readme and/or top of the docker file? localhost:50922 goes to container:10022 which goes to guest:22
Author
Owner

@jviotti commented on GitHub (Jun 26, 2020):

@sickcodes This is the output of docker ps. I'm not very familiar with Docker but I would have expected to see something in the PORTS column:

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
e082f90113ab        catalina            "/bin/sh -c 'ls -la …"   25 hours ago        Up 25 hours                             competent_bassi

And I'm running the image as:

docker run \
  --privileged \
  --net host \
  -p 50922:10022 \
  -e "DISPLAY=${DISPLAY:-:0.0}" \
  -e RAM=6 \
  --cap-add=ALL \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  -v /dev:/dev -v /lib/modules:/lib/modules \
  -v /var/run/libvirt/libvirt-sock:/var/run/libvirt/libvirt-sock \
  catalina

The corresponding line from Launch.sh is also correctly substituted with envsubst:

-netdev user,id=net0,hostfwd=tcp::10022-:22, -device e1000-82545em,netdev=net0,id=net0,mac=52:54:00:09:49:17

And remote login is enabled:

Screen Sharing Picture 26 June 2020 at 20 50 46 BST

@jviotti commented on GitHub (Jun 26, 2020): @sickcodes This is the output of `docker ps`. I'm not very familiar with Docker but I would have expected to see something in the `PORTS` column: ``` CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e082f90113ab catalina "/bin/sh -c 'ls -la …" 25 hours ago Up 25 hours competent_bassi ``` And I'm running the image as: ``` docker run \ --privileged \ --net host \ -p 50922:10022 \ -e "DISPLAY=${DISPLAY:-:0.0}" \ -e RAM=6 \ --cap-add=ALL \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -v /dev:/dev -v /lib/modules:/lib/modules \ -v /var/run/libvirt/libvirt-sock:/var/run/libvirt/libvirt-sock \ catalina ``` The corresponding line from `Launch.sh` is also correctly substituted with `envsubst`: ``` -netdev user,id=net0,hostfwd=tcp::10022-:22, -device e1000-82545em,netdev=net0,id=net0,mac=52:54:00:09:49:17 ``` And remote login is enabled: ![Screen Sharing Picture 26 June 2020 at 20 50 46 BST](https://user-images.githubusercontent.com/2192773/85895520-c4cba000-b7ee-11ea-8e57-098573bb97c3.png)
Author
Owner

@jviotti commented on GitHub (Jun 26, 2020):

@sickcodes I was able to connect to it by omitting the --net host option in docker run. The port is bound and I can see that in docker ps, however the VM has no internet connection now :/

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                      NAMES
bcfb06563a21        catalina            "/bin/sh -c 'envsubs…"   3 minutes ago       Up 3 minutes        0.0.0.0:50922->10022/tcp   mystifying_cray
@jviotti commented on GitHub (Jun 26, 2020): @sickcodes I was able to connect to it by omitting the `--net host` option in `docker run`. The port is bound and I can see that in `docker ps`, however the VM has no internet connection now :/ ``` CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES bcfb06563a21 catalina "/bin/sh -c 'envsubs…" 3 minutes ago Up 3 minutes 0.0.0.0:50922->10022/tcp mystifying_cray ```
Author
Owner

@jviotti commented on GitHub (Jul 6, 2020):

@sickcodes Any clues about this? I've been trying some long shots, but I feel that I'm mostly in the dark. I'm following the instructions exactly as described in the README, so it must be something in my host system, right?

@jviotti commented on GitHub (Jul 6, 2020): @sickcodes Any clues about this? I've been trying some long shots, but I feel that I'm mostly in the dark. I'm following the instructions exactly as described in the README, so it must be something in my host system, right?
Author
Owner

@sickcodes commented on GitHub (Jul 7, 2020):

Building on mine and checking now

@sickcodes commented on GitHub (Jul 7, 2020): Building on mine and checking now
Author
Owner

@jviotti commented on GitHub (Jul 7, 2020):

@sickcodes I think got to the bottom of it. The DNS requests would get blocked by firewalld on my Fedora 32 system. See this snippet from docker0 after trying to ping google from within the container:

Screen Sharing Picture 7 July 2020 at 11 04 14 BST

Things work again if I set docker0 to the trusted zone:

firewall-cmd --permanent --zone=trusted --add-interface=docker0
firewall-cmd --reload

See https://github.com/docker/for-linux/issues/955

@jviotti commented on GitHub (Jul 7, 2020): @sickcodes I think got to the bottom of it. The DNS requests would get blocked by `firewalld` on my Fedora 32 system. See this snippet from `docker0` after trying to ping google from within the container: ![Screen Sharing Picture 7 July 2020 at 11 04 14 BST](https://user-images.githubusercontent.com/2192773/86765897-add44b80-c041-11ea-968f-f05a263e1b15.png) Things work again if I set `docker0` to the trusted zone: ``` firewall-cmd --permanent --zone=trusted --add-interface=docker0 firewall-cmd --reload ``` See https://github.com/docker/for-linux/issues/955
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Docker-OSX#50