How to SSH access

How can I access to individual sites via SSH? - In order to use WP-CLI


You can SSH in by right-clicking on the site in the sidebar then going to Open Site SSH :smiley:

After doing that you can immediately use wp without changing directories.


Perfect. Thank you.

Guess this is a FAQ question, @clay how can I access a site using ssh, but not using the Local application, ie not right-clicking the site but doing: ssh

what’s the username and password I should use ?


+1 Need to ssh into - whats the password?


There appears to be no password. Local runs its wordpress components in docker containers, and makes a script for each container that does “docker exec -it [docker-container-id] /bin/bash” to allow you to execute commands on them.


5 posts were split to a new topic: Running PHPUnit in PhpStorm with Local

Learned how to log into the Local machine:

ssh -i ~/.docker/machine/machines/local-by-flywheel/id_rsa docker@

You’ll find the IP-address in Local->Database dashboard


Edit after re-reading the thread…
Anyone recommend a SSH for Win10?

Hi @mitchrosefelt,

Can you please explain what you’re trying to do?

If you right-click on the site in Local’s sidebar then go to “Open Site SSH” it should open it up in Cmd automatically. :slight_smile:

right click to get ssh only works if your default shell is bash. (if you are using fish it doesn’t work)


wp-cli offers a global parameter –ssh= what do I write after that to gain access for wp-cli in my shell to a site on Local?

Perform operation against a remote server over SSH 
(or a container using scheme of “docker”, “docker-compose”, “vagrant”).

Hey guys, the reason there isn’t a straightforward answer to give is that these are all Docker containers, but we don’t have you install Docker on the host machine such that it is accessible to your $PATH.

You can tease out what exactly is happening when you are right-clicking and "Open Site SSH"ing by opening the file that is reported in the terminal.

Here’s a screenshot of two terminals I have open, one from clicking Open Site SSH, and one where I open the bash script that the first terminal executed:

Since this is a bash script, that’s why right-clicking within Local won’t work with Fish – this is just a bash script.

When I open that script, there are instructions for connecting to the site’s specific Docker machine:

export DISABLE_AUTO_TITLE="true"
echo -n -e "\033]0;newblank SSH\007"
eval $("/Users/benjamin/Applications/Local by" env local-by-flywheel);
"/Users/benjamin/Applications/Local by" exec -it d78472ef6d4f9a4dd1dda96c7a41f94bffad69c60435ec5dff8f0461a379ce09 /bin/bash;

You can break this down into something more easy to understand:

eval $('...' env local-by-flywheel);

This line sets up the terminal session to use the Docker environment that’s running within the local-by-flywheel VM.

".../docker" exec -it <container_id> /bin/bash;

This line is using the environment we set up in the previous line to create an interactive, teletype terminal running bash.

To your specific question @crs1138 – I haven’t tried this, but you might be able to install Docker so that it’s accessible to your $PATH and then execute commands directly against the container hash found in that bash file.

I think that it would look something like:

  1. Install Docker: brew cask install docker
  2. Ensure the Local VM is running, and then make Docker use that environment: eval $(docker-machine env local-by-flywheel)
  3. Docker commands – for example docker ps to list the running containers.

If you try this out, let me know what you find!

– Ben


Hi Ben, this is is what I got…

 eval $(docker-machine env local-by-flywheel)
 docker ps
 CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                                                                         NAMES
 e9cb6d4b4a08        flywheel:1.1        "nginx -g 'daemon of…"   2 minutes ago       Up 2 minutes>80/tcp,>443/tcp                                                      youthful_pare
 2db760ae1612        custom:1.2          "/etc/scripts/sleep.…"   5 weeks ago         Up 2 minutes>80/tcp,>443/tcp,>1080/tcp,>3306/tcp   trusting_lovelace
 2ec093e05eae        custom:1.2          "/etc/scripts/sleep.…"   8 weeks ago         Up 2 minutes>80/tcp,>443/tcp,>1080/tcp,>3306/tcp   naughty_jackson

WTF is naughty_jackson or trusting_lovelace? :flushed::crazy_face::joy:

1 Like

Haha, those are some interesting ones!

Now that you have the container IDs, you can “SSH” into the first one using the custom:1.2 image by running docker exec -it 2db760ae1612 /bin/bash.

How do I use that with the wp-cli --ssh= flag?

Great @crs1138 – after you setup the environment for the terminal session:

eval $(docker-machine env local-by-flywheel)

You should be able to reference the naughty_jackson site using that container id:

wp post list --ssh='docker:2ec093e05eae' --allow-root

You’ll need the --allow-root part since within the container, the processes are being executed as root.

It still gets odd with file permissions and such, but that should be enough for you to be dangerous :slight_smile:

Trying to work out how to set up to ssh into the docker container -

something like
ssh -R ~/.docker/machine/machines/local-by-flywheel/id_rsa docker@

any clues?

Trying to use + autossh to create more persistent tunnel addresses than, collaborators are sick of tunnel addresses changing each time reboot.

It’s a bummer. This used to work for me some of the time, and now it doesn’t work anymore. I’ve used the long method of connecting that ben.turner provided, which I appreciate, but it seems like this just hasn’t been a reliable function of Local for quite some time. It’s a very important feature, too.

Can this please get some attention from Flywheel?

After doing some digging, I think I found where the problem is happening. Hopefully this will help the Local team to fix the issue, and others to throw together a workaround much easier than described above.

When you right-click on a site and go to “Open Site SSH” it opens your terminal and runs a command. If you’re like me, the command closes prematurely. If you’re in iTerm it throws and error and closes the tab. If you use Terminal, it will leave it open and state that it’s closed.

The line to look out for here is something like the following:

/Users/jason/Library/Application\ Support/Local\ by\ Flywheel/ssh-entry/; exit;

The ssh-entry directory contains a bunch of bash scripts for the respective sites. Each script does all the heavy lifting to identify the site’s container and connect to it via docker. In my case, the site I’m trying to connect to is

What’s odd here is that the script is immediately followed by exit;. It seems like the bash script runs asynchronously (or is using asynchronous command). If the docker connection isn’t made in time, the exit; command runs and closes the shell. If it happens to work fast enough, it connects.

So if you execute the file directly, without the exit; command, it works great! In my case, I made a file in my project that has only the following:

/Users/jason/Library/Application\ Support/Local\ by\ Flywheel/ssh-entry/

And just like that, it connects every time.

I suppose the big question for the Local team is why they included the exit; command after executing the bash script? Omitting that seems to resolve the issue, and if connecting to docker works then it ignores the command.

Hope this helps! :slight_smile:

1 Like