Use a Vagrant machine as SFTP connection in NetBeans - netbeans

I have a little trouble using NetBeans to work on my Vagrant virtual server. What I tried is to create a new PHP Project on a remote server, then NetBeans ask me for the connection so I created a new connection. For hostname I putted in 127.0.0.1 and as user vagrant I linked the private key file (generated by vagrant) and filled in the initial directory.
When I try to connect like this it asks me for the password for user vagrant (which I don't have, since it should provide the private key file...). With Vagrant I would need to connect to port 2222 instead of 22 for ssh connections anyway, so I changed the hostname to 127.0.0.1:2222. Now I get a java.net.UnknownHostException: 127.0.0.1:2222
Therefore the question: Was anyone of you able to connect to a vagrant machine with SFTP using NetBeans? If yes, how?
Note: Not sure if it's important, but I'm using an Ubuntu 14.04 machine and my NetBeans version is 8.0.2, I've installed the PHP/Web package.

I realize this was asked a long time ago, but it seems like other people have this issue as well. This works for me on my Mac:
Host: 127.0.0.1
Port: 2222
Protocol: SFTP
user: vagrant
pass: vagrant
You end up in the vagrant home directory /home/vagrant.

Related

mysqlworkbecnh connection to mysql

I could not connect to mysql with my mysqlworkbench.
I am using mamp and it gives me the below error:
Failed to Connect to MySQL at localhost:8888 with user root
I have put the username "root" and no password.
Hostname:localhost Port:8888
Normally we get this issue when the port is used from another app in the background.
So check your running programs or change mamp port itself to anything else like
port:7001.
I recommend Xampp if you're using Windows Operating system. It works well on port:3306.

Accessing postgres server with limited pg_hba.conf access

I am trying to access a postgres server that has limited IP access in pg_hba.conf file.
I am trying to use dbeaver to access it.
I am - computer A
postgres server - computer C
server i can access postgres server from - computer B
In my computer I have this view.
As far as I understand I need to trick my computer into using the computer B.
So when i write postgreserver.blaah.com into host/ip and port 5432. It will ssh to computer B and then access it from there.
So in my ssh config file i wrote this:
LocalForward 5432:postgreserver.blaah.com:5432 myuser#server.b.com
Well this didn't work.
Any suggestions?
I don't think you should do anything in your ssh config (and which computer's ssh config was it?). DBeaver's SSH tab is an alternative to manually setting up your own tunnel.
If you have already manually set up your own tunnel, then you would just point DBeaver to it, you wouldn't tell DBeaver that it is using a tunnel. It doesn't need to know.
If you want DBeaver to set up the tunnel, then "computer_B" would go in the Host/IP field of the SSH tab. "computer_C" would go in the Host field of the Main tab.
I ended up using
ssh -L5432:databasehostname:5432 intermediatehostname
So this is running in a random shell somewhere on my screen while i am working with the database.
In DBeaver the hostname is localhost and port is 5432
and i am using Main connection tab not ssh tunnel.

Golang and accessing postgres via a client in an Ubuntu VPS?

I'm trying to follow the digital ocean tutorial on configuring pgadmin4 in server mode, but damn it is long, and I have to first configure apache server, python and virtualenv (via other 2 tutorials).
I don't want to install so many dependencies in my server just to access postgres via pgamin 4.
How do you guys do it?
I'm running a go webserver via https listening on ports 443 and redirecting 80 to 443
Seeing your other answer I would like to offer a more secure alternative.
What's wrong with the current approach?
Your PostgreSQL instance is accessible from the internet. Generally you should try to limit access only where it is required. Especially if you are not using SSL to connect to PostgreSQL, an open port like this is a target for traffic interception and brute force attacks.
Alternative
Seeing that you are you using JetBrains IDE's you only need one other step to access your data - setting up a SSH tunnel.
This encrypts with SSH all your connections between development host and server without exposing PostgreSQL to the outside world.
In the connection settings for your database in the Jetbrains IDE select the SSH/SSL tab and "Use SSH tunnel". Input the information of your server and the SSH user + password/SSH key (use SSH keys for better security) into the relevant input fields.
Undo the settings changes you did to open the firewall and configure PostgreSQL to listen to all nodes.
Connections to your database are now possible over encrypted tunnels without exposing your database to any unwanted attacks.
So this is what I did to achieve connection from my laptop to my ubuntu VPS, via webstorm (I suppose any intellij works also should work with other IDE's)
0 login to your server
1. Locate postgresql.conf usually under /etc/postgresql/10/main
2. sudo nano postgresql.conf
3. Locate and change line at connections
listen_addresses = '*'
Then in same dir edit: sudo nano pg_hba.conf
#TYPE DATABASE USER ADDRESS METHOD
host all all 0.0.0.0/0 md5
Md5 means I connect with user and his password
5 Dont forget to allow ufw (firewall)
sudo ufw allow 5432/tcp
Open webstorm > Database (tab) > click + to add PostgtresSQL source (fill relevant info, user name, password, database name, host and port, etc...)
jdbc:postgresql://example.com:5432/my_database_name
Press on schemas and synchronize OR press:
Source > Settings > Schemas tab > [check] All Databases > refresh

How to access a remote Postgres database using a local GUI tool

I am running openerp(odoo) application from amazon cloud server using putty and it is ubuntu Headless(NO GUI) server. PostgreSQL is the database used for this application. Right now I am only able to access it in command mode as there is no gui in Putty. In Windows, I have installed pgadmin3. Is it possible to access it from here by configuring?
You can configure your security group to open up the postgres port accessible from your IP address (I would highly recommend the access to be limited that way). After that you can just point your GUI client the external IP address of your instance using the port where the service is running on.
I suggest you to use pgadmin gui tool to access postgres database.
You can set up an SSH tunnel in putty and use that to access the remote database with your local pgadmin3. This is a very good and secure way to do things.
First, in Putty (Connection / SSH / Tunnels) add a source port of your choice, 5000 for example. Then enter localhost:5432 for Destination (providing postgres is running on port 5432 on the server). Press Add and save your session. Next time you open your ssh connection with Putty, the tunnel will be active.
After this, set up a new connection in pgadmin3, Host: localhost and Port: 5000 (and your username and pasword, of course). Now, if the putty session is active, you should be able to connect.
In postgresql.conf file, find a line called
listen_addresses = 'localhost' and change it to '*'
Next in pg_hba.conf add this line in IPV4 local connections,
host all all (Your external ip address in CIDR format) trust
Finally restart the database using this command,sudo service postgresql restart

MAMP - storing Database online?

I am wondering if it is possible while using MAMP to have the database online?
I am developing a couple sites locally between work and home, and initially thought I could get mamp to store or point to my external drive. No bueno.
SO am thinking I can still run mamp at work or at home pointing to my external drive but the DB that it would connect to would be online?
Depending on your system you could set up an SSH tunnel to another computer running the database. SSH tunneling allows you to direct a port on your computer (For example port 8889 which MAMP uses by default for the MySQL port) to a port on another computer. If set up correctly, you tell MAMP that you are using local port 8889, but ssh will then direct all traffic to the remote computer's mySQL port which is where you could run your database. This link has a good tutorial on how to do this provided that you have ssh installed.