Sequel pro + ssh to vagrant

What is the basic setup for sequel pro connecting to vagrant?

I had it working but now (with SSL certs added) I can’t seem to connect to a site I previously was able to connect to.

Setup in Sequel Pro

mysql host: 127.0.0.1 user: root pass: root ssh host: mysite.dev ssh user: vagrant ssh pass: vagrant
Error in Sequel Pro is Permission denied (publickey). but keys are added on vagrant up. Also have done several provisions and destroy/up.

This was working previously, sigh.

1 Like

Which box are you using? If VVV you can connect directly. See the direct connection section here: https://github.com/varying-vagrant-vagrants/vvv/wiki/Connecting-to-MySQL

I’ve had similar problems in the past. SSH worked on the first box I set up, but then would not work on any box after. I tracked some info down about this in the past but I don’t remember exactly what it was. I think it had something to do with known hosts, check the article below

https://laracasts.com/forum/?p=1096-sequel-pro-not-connecting-to-vagrant-via-ssh/0

Hopefully that helps.

Already read through those articles before posting here :wink: The only thing different in the setup I have now is I’ve added SSL.

Use the insecure private key inside the .vagrant folder.

tried that already too

Try SSHing manually to the VM with the credentials you are using in SequelPro to see if it works. ssh vagrant@mysite.dev.

This might help. It’s really a laravel tutorial, but it’s a similar setup with a digital ocean vps.

The beginning of the video doesn’t apply, around the middle he explains how to use sequel pro to connect via ssh. Hope it works.

I am able to connect using the private _key and DB credentials for the specific box.

When trying to SSH I get

The authenticity of host 'mysite.dev (192.168.50.5)' can't be established.
RSA key fingerprint is 6e:86:1a:f1:84:9e:92:b8:c3:fe:bd:cd:e9:e1:e2:df.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'mysite.dev' (RSA) to the list of known hosts.
Warning: the RSA host key for 'mysite.dev' differs from the key for the IP address '192.168.50.5'
Offending key for IP in /Users/username/.ssh/known_hosts:4
Are you sure you want to continue connecting (yes/no)? yes
Permission denied (publickey).
MacBook-Pro:~ username$

I recently started toying with OpenSSH certs, I’m thinking this is what is causing the issue.

Reading the Vagrant docs, this could be where my issue sits

To configure SSH access with the insecure keypair, place the
public key into the ~/.ssh/authorized_keys file for the "vagrant" user.
Note that OpenSSH is very picky about file permissions.
Therefore, make sure that ~/.ssh has 0700 permissions and
the authorized keys file has 0600 permissions.

When Vagrant boots a box and detects the insecure keypair, it will
automatically replace it with a randomly generated keypair for additional
security while the box is running.

I noticed that when I Vagrant Up I get Vagrant insecure key detected. which Vagrant then replaces. This looks like I’ve messed my SSL certs and I am at a loss on how to address it.

If I try and ssh vagrant@mysite_no_ssl.dev I can shell right in. However if I ssh vagrant@mysite_ssl_enabled.dev I get permissions denied.

I can still run from within the site folder vagrant ssh. Should I be looking to replace the SSL certs manually within each site that I have this problem?

Still can’t connect to database using Sequel Pro. Tried all configs possible for SSH and also tried direct connection.

@buretta Try this example: Brain imploding trying to get bedrock + bedrock-ansible running... please help
No idea why the 127.0.0.1 ip doesn’t work since it’s binded to mysql and in the vagrant ssh-config readout. Maybe a key for that IP already exists in known_hosts.

I’ve removed all key’s for that host, I can also re-produce this issue on 2 separate machines.

When I try to ssh in Sequel Pro with the suggested 192.168.50.5 setup I get the follow error

OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 53: Applying options for *
debug1: Connecting to 192.168.50.5 [192.168.50.5] port 22.
debug1: fd 3 clearing O_NONBLOCK
debug1: Connection established.
debug1: identity file /Users/username/.vagrant.d/insecure_private_key type -1
debug1: identity file /Users/username/.vagrant.d/insecure_private_key-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3 pat OpenSSH*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 01:a6:9a:a0:fb:b8:4f:95:93:77:f0:67:89:45:8e:ca
debug1: Host '192.168.50.5' is known and matches the RSA host key.
debug1: Found key in /Users/username/.ssh/known_hosts:9
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/username/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/username/.vagrant.d/insecure_private_key
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

Also having problems with this :confused:

I’m wondering if it’s a particular version that we are having troubles with.

When did you pull Trellis? Mine was setup with this being the last commit , Aug 28, 2015 https://github.com/roots/trellis/commit/7dacb9faa9e8591da65cf2ac5577cac496d0eef4

I pulled trellis last friday

You have SSL enabled for development env?

What version of Vagrant are you running? vagrant --version

I’m running Vagrant 1.7.4

I was able to finally get this working, however I am hesitant to say it’s the correct way. Maybe others can chime in and provide better insight.

Vagrant changed the behaviour between 1.6 and 1.7 versions and now will insert auto generated insecure key instead of the default one. I’m still learning, but to continue working and ssh into the VM I applied config.ssh.insert_key = false into the vagrant file and then re-provisioned the VM. Below is a reference to where I added this, line 28.

25. Vagrant.configure('2') do |config|
26.  config.vm.box = 'ubuntu/trusty64'
27.  config.ssh.forward_agent = true
28.  config.ssh.insert_key = false

Once the above was added and the VM reloaded I was able to use Sequel with the following config

name:local.mysite.dev
mySQL host: 127.0.0.1
username: name_used_in_group_vars/devlopment/wordpress_sites.yml
password: pass_used_in_group_vars/devlopment/wordpress_sites.yml
sshHost: mysite.dev
ssh user: vagrant
ssh key: mysite.dev/.vagrant/machines/default/virtualbox/private_key

I haven’t tested this across other projects yet.

What I need to further learn is the proper way to setup vagrant. Looking into the docs I believe I have not setup my authenticated_keys which seems to be the reason (at least in vagrant 1.7) why I ran into trouble all of a sudden. I had this setup https://github.com/varying-vagrant-vagrants/vvv/wiki/Connecting-to-MySQL but then things went to sideways for no clear reason or what changed…keeping in mind I’m flying solo and reading all the docs AND work gets a bit much and likely missed some clear statement about a certain change.

6 Likes

I wasn’t able to connect with the ssh key path shown in other instructions in the forum (the one in the .vagrant.d folder).

I changed it to this and now it works!

Thanks buretta.

5 Likes