CentOS 7 vsftpd keeps rejecting PhpStorm FTP Connection - phpstorm

I recently installed vsftpd on a server at my home for local development utilizing CentOS7. I went through the setup, and enabled passive mode, set up my ports, put my port forwarding on in my router, and then when I go to connect through PhpStorm, it rejects the connection.
I'm not sure what's going on, I've tried enabling Anonymous login, using a user, root. Nothing seems to work. Please let me know any information I can add.
The result from Test Connection is as follows:
Connection to '10.0.0.110' failed.
Connection to FTP server on "10.0.0.110" rejected.
Here are results from a FileZilla attempt.
Status: Connecting to 10.0.0.110:40000...
Status: Connection established, waiting for welcome message...
Response: 500 OOPS: failed to open xferlog log
ile:/var/log/vsftpd/vsftpd.log
Error: Critical error: Could not connect to server

Alright, so here is the answer, after looking in to what #LazyOne posted. I needed to change permissions as the first step. chmod 644 / 755 for files / dirs.
After that, I added in a listen_port=40000 to my vsftpd.conf file.
Then, I added in port_enable, pasv_address=<my internal ip address for my server> and lastly, pasv_addr_resolve=NO, as I have a static IP on my server.
I also added additional ports to the passive settings 40000-40500, as I've read this will allow multiple connections and will solve another error I was having.
After all of this, I opened up the ports in my server firewall-cmd --add-port=40000-40500/tcp --permanent, and added port forwarding in my router to allow this.
After all was said and done, I was finally able to connect to my FTP.
Hopefully this will help someone.

Related

Digital ocean sql connection and phpmyadmin suddenly stopped working

I have a Laravel app on digital ocean and it runned fine for about 4 days now.
But today when I woke up it suddenly couldn't connect to the DB.
Also when I try to login in phpmyadmin it says
2002 - Connection refused — The server is not responding (or the local server's socket is not correctly configured).
I tried changing localhost to 127.0.0.1 in the config-db.php file and restarting apache, because some guy in their forums had the same problem and said that it fixed it for him, but for me it had no effect.
Other errors I see are
mysqli_real_connect(): (HY000/2002): Connection refused
Connection for controluser as defined in your configuration failed.
mysqli_real_connect(): (HY000/2002): Connection refused
I am certain that no configuration files have been changed, it just stopped working, why that might be, and how to prevent it in the future ?
The OS is Ubutnu 18.04.13 (if it matters)
It would appear as if your MySQL daemon is no longer running.
The hints here are that the Laravel app is not able to reach the MySQL server, and that phpMyAdmin is also unable to reach the MySQL server.
You should look in the MySQL error log for hints. You may also find hints in your syslog, depending on how your system is configured. This could give you information about why the service has stopped. You might also find information in the systemd log, which can probably best be viewed with journalctl -u mysql -b.
You could verify that it's actually stopped with systemctl status mysql, even though it's difficult for me to think of a reason why it would be running correctly but not responding to any connection attempts.
Next, you should probably start the service again with sudo systemctl start mysql. If it fails to start, you'll see some information about why not with information about viewing the log file, which you can copy and paste in to your question to help us further with troubleshooting.

what is the server name of mySQL hosted on EC2?

I have installed LAMP on my EC2, running mariaDB.
So now I would like to connect to mySQL, but what should my $servername be in the .php file (where i store the db_connect details)?
I've tried the Public DNS (IPv4) address of the instance provided on the EC2 dashboard, however, I am getting connection fail error when I run the .php files.
Am i using the right server name here?
Or is it because I need to set some access rights regarding Security group? I've added port 3306,tcp,0.0.0.0/0 to the Security Group but still getting the "Connection failed: Access denied for user 'root'#....."
I've also checked the my.cnf, which i assume it should not have any bind address values in it?
It seems this is credentials issue, port listening seems working fine. Are php files running on same box? if so, use "localhost", that should work fine. Here is tutorial on how to enable remote connections.
Good luck!

Apache cant connect to mysql

I have Centos 6 with MySQL 5.7 installed
when i restart computer and trying to access web site i recive next error:
Software error:
Can't connect to the database.
Error: Access denied for user ''#'localhost' to database 'bugzilla_DB'
Is your database installed and up and running?
Do you have the correct username and password selected in localconfig?
if i connect to server and restart HTTPD service all start working untill next restart.
i checked:
1. mysql starts a lot before httpd
2. waiting few minutes after server starts not help until i make httpd restart
3. mysql.pid and mysql.sock are ok
4. selinux disabled
5. iptables not used and disabled
6. no additional error in mysql.log
This seems to be related to your web site source code trying to access MySQL.
You need to enter the right connection (host and port) info and user credentials in your source code (wherever authentication is made).
This has nothing to do with (the erratic premise) that Apache connects to MySQL. It does not (in any normal out-of-the box installation).
This being said, you should still provide more information, the following statement requires more facts about your setup:
if i connect to server and restart HTTPD service all start working untill next restart.
I Found the problem. RiggsFolly was right. the problem in local config.
when HTTPD starts as service with boot that is limited environment and correct user required. when i make service restart after boot i logging in and service uses correct user environment and connects to MySQL as that user. so proper configuration of localconfig fixed the problem.
thanks to all of you.

PhpStorm + MySQL Setup

I have been trying to set up a new MySQL connection in PhpStorm (2016.1) for days now and cannot figure it out.
I am on a Mac OS X 10.11.4 and I have a Home Server (Ubuntu 14.04) and MySQL (5.5). I have a Firewall setup on the Server and have allowed all local connections to pass through (verified by connecting to MySQL on another computer).
I went into PhpStorm and added a new Database, entered the IP address (even tried host name) of remote (Home Server), and all credentials. When I hit "Test Connection" I get an error of
"Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection Refused"
I have "googled" about this error and one suggestion is to uncomment the localhost line in your hosts file (it was never commented out). I then though, maybe I need to have MySQL installed on my Mac, so I installed the current MySQL. Still get the same error. I even went under the SSH tab (PhpStorm) under the database setup and tried to set up a SSH Tunnel, still the same error.
Any suggestions?
(Posted on behalf of the OP).
After talking with JetBrains they were able to help me out. For some reason an address within my /etc/hosts file (on my Mac) was messing the connection up. Once I removed it, it connected. Somehow one of the IP addresses was making it loop back to localhost.

Lost connection to MySQL server at 'reading initial communication packet', system error: 0 on a windows machine

I found similar questions but none of them helped me with a windows machine.
I was able to connect to mySQL through my local machine. However, I have placed MySQL on a remote machine and when I try to connect to it, I get the following error:
Lost connection to MySQL server at 'reading initial communication packet', system error: 0
Im using SQL workbench to connect. I use the remote machine's actual name for the hostname and using port 139. I have MySQL started up as a service on the remote machine as well. When googling the error I get lots of jazz about editing a file in /etc/hosts.allow and my.cnf and whatnot. However, these locations were specified for linux machines. I have a windows 7 machine for both my local and the remote machine and therefore do not have these locations.
Any help would be greatly appreciated.
I am not going to pretend that I know what caused this problem but it could be:
1.That you need to add
AllowTcpForwarding yes
to this file: /etc/ssh/sshd_config. Obviously since you are on windows you need to find its equivalent because that's a linux filepath.
2.It could be your firewall. Try temporarily disabling it (if it is safe to do so) and see if it works. If this is the case you will need to grant MySQL access through the firewall.
3.Try writing
mysqld: ALL: allow
In the file /etc/hosts.allow again since you are on windows you need to find its equivalent because that's a linux filepath. Now this may kind of be a security whole in some ways but who cares about security when you don't have a running server?
4.Now the last this is to check /etc/hosts.deny your IP might be there denying you access to your server.
Figured it out. 'root' was pointing to the root of the local machine and the root user on the remote machine was pointing to itself. So I had it connect to an admin user and it connected fine with no errors. Thanks for for the responses and help guys.