Sequel Pro + Vagrant + Multiple sites on one box

Hi,

I have two websites set up and running on my vagrant local instance

[nlott@Neils-MacBook-Pro trellis]$ vagrant global-status
id name provider state directory

14ae5aa default virtualbox running /Users/nlott/work/websites/nlott.com/trellis
3ca6533 default virtualbox running /Users/nlott/work/websites/environmentcelebration.com/trellis

I can connect to my nlott.dev box just fine.

But if I try to connect to the environmentcelebration.dev box (everything is pretty much the same except the vagrant private key – I’m using the private key (environmentcelebration.com/trellis.vagrant/machines/default/virtualbox/private_key)

And the root password applies to the vault.yml for environmentcelebration.com – i get this error

Used command: /usr/bin/ssh -v -N -S none -o ControlMaster=no -o ExitOnForwardFailure=yes -o ConnectTimeout=10 -o NumberOfPasswordPrompts=3 -i /Users/nlott/work/websites/environmentcelebration.com/trellis/.vagrant/machines/default/virtualbox/private_key -o TCPKeepAlive=no -o ServerAliveInterval=60 -o ServerAliveCountMax=1 -p 2222 vagrant@127.0.0.1 -L 55067:127.0.0.1:3306 -L 55068:127.0.0.1:3306

OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /Users/nlott/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Control socket " none" does not exist
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 2222.
debug1: fd 3 clearing O_NONBLOCK
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /Users/nlott/work/websites/environmentcelebration.com/trellis/.vagrant/machines/default/virtualbox/private_key type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/nlott/work/websites/environmentcelebration.com/trellis/.vagrant/machines/default/virtualbox/private_key-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2
debug1: match: OpenSSH_7.2p2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 127.0.0.1:2222 as ‘vagrant’
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-ed25519 SHA256:bNVah7CLiTCCEIuYs6RlYE94slxi0GSXm0kH/ojVckw
debug1: Host ‘[127.0.0.1]:2222’ is known and matches the ED25519 host key.
debug1: Found key in /Users/nlott/.ssh/known_hosts:17
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/nlott/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/nlott/work/websites/environmentcelebration.com/trellis/.vagrant/machines/default/virtualbox/private_key
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

My users.yml:

Also define ‘vault_users’ (group_vars/staging/vault.yml, group_vars/production/vault.yml)

users:

  • name: “{{ web_user }}”
    groups:
    • “{{ web_group }}”
      keys:
    • “{{ lookup(‘file’, ‘~/.ssh/id_rsa.pub’) }}”
    • “{{ lookup(‘file’, ‘~/.ssh/id_rsa-dusty.pub’) }}”

    - https://github.com/username.keys

  • name: “{{ admin_user }}”
    groups:
    • sudo
      keys:
    • “{{ lookup(‘file’, ‘~/.ssh/id_rsa.pub’) }}”
    • “{{ lookup(‘file’, ‘~/.ssh/id_rsa-dusty.pub’) }}”

    - https://github.com/username.keys

web_user: web
web_group: www-data
web_sudoers:

  • “/usr/sbin/service php7.1-fpm *”

I verified my public rsa key in ~/.ssh/id_rsa.pub is in the authorized_keys on the vagrant server

vagrant@environmentcelebration:~/.ssh$ authorized_keys
vagrant@environmentcelebration:~/.ssh$

Is there a detail I’m missing?

Thanks,

Neil

1 Like

Try: Use domain names as ssh host, e.g: example.dev

If still fail, also try login as db user instead of root:
Username: example_com
Password: example_dbpassword (use the value of db_password from group_vars/development/vault.yml)

2 Likes

Forget what I said previously…

# Install vagrant-trellis-sequel
# Make sure you have v0.2.1 or later installed!
$ vagrant plugin install vagrant-trellis-sequel

$ cd /Users/nlott/work/websites/environmentcelebration.com/trellis
$ vagrant trellis-sequel open

# That's all
1 Like

Awesome tried it and super easy!