PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, February 2, 2022

[FIXED] I cannot connect after enable Firewalld on CentOS7

 February 02, 2022     centos, centos7, firewalld, lamp     No comments   

Issue

I'm trying to setup LAMP to CentOS7 with a guide. I tried to run these commands to allow HTTP and HTTPS traffic:

sudo firewall-cmd --permanent --zone=public --add-service=http 
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload

But system give this error:

FirewallD is not running

So I searched for it then apply these commands:

systemctl enable firewalld
systemctl start firewalld

Then it printed "completed" output but my connection was aborted and I cannot connect to the server with IP:Port with PuTTy anymore.

What should I do? The only access to the server was that way for me. I have no physical access to the server.


Solution

It looks like you locked yourself out, as you did not specify that ssh should also be allowed:

sudo firewall-cmd --permanent --zone=public --add-service=http 
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --permanent --zone=public --add-service=ssh
sudo firewall-cmd --reload

The guide above seems to assume that ssh is already allowed.

What should I do? The only access to the server was that way for me. I have no physical access to the server.

So at this point the only way to access the server will typically be via the VM console of your hosting provider / virtualisation solution. Almost all providers will allow you access to that console, so you should try to do that. Once logged in via the console, you can then run the above command to allow SSH to regain access via SSH.



Answered By - Simon
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing