How to Unblock SSH and FTP Access to Specific IP in Linux

0 votes

How can I actually check whether I'm being blocked by a firewall between my Linux machine and a target host? In case the firewall is blocking the connection how to do I unblock it?

Is it possible to allow and deny connections from IPs in Firewall? Or is it just the IP Tables?

Jul 16, 2019 in Linux Administration by datageek
• 3,090 points

edited Jul 16, 2019 by datageek 14,648 views

1 answer to this question.

0 votes

Firewalls(most of them) can either Reject or Deny/Drop the traffic.  Reject action sends an ICMP Port/Destination Unreachable response back to the source while Drop/Deny action sends nothing back and will silently drop the connection. Which means the firewall is blocking the traffic.

Use the following syntax you can unblock an IP (the -d options deletes the rule from table):
# iptables -D INPUT -s xx.xxx.xx.xx -j DROP
# iptables -D INPUT -s 65.55.44.100 -j DROP
# service iptables save

To unblock or enable SSH access, go to the remote server and run the following command:

  1. Using IPtables Firewall

    # iptables -I INPUT -s 192.168.1.100/24 -p tcp --dport ssh -j ACCEPT            

  2. Using FirewallD

    firewall-cmd --direct --add-rule ipv4 filter INPUT 1 -m tcp --source 192.168.1.100 -p tcp --dport 22 -j ACCEPT

To unblock ftp access

  1. ​iptables -I INPUT -s 192.168.1.100 -p tcp --dport 20,21 -j ACCEPT   or

  2. firewall-cmd --direct --add-rule ipv4 filter INPUT 1 -m tcp --source 192.168.1.100 -p tcp --dport 20,21 -j ACCEPT

Try it out!

Hope this helps you!

To learn more about Linux, it's recommended to join Linux course online today.

Thanks.

answered Jul 16, 2019 by Archana
• 5,640 points

Related Questions In Linux Administration

0 votes
2 answers

How do I find all files containing specific text and rename in unix/linux

Hi, @Kal You can use this command below to ...READ MORE

answered Jul 2, 2019 in Linux Administration by Gitika
• 65,910 points

edited Jul 2, 2019 by Gitika 2,043 views
0 votes
1 answer

How to configure FTP server in Linux System?

Hi@akhtar, You need to install vsftpd software in ...READ MORE

answered Jul 9, 2020 in Linux Administration by MD
• 95,440 points
613 views
0 votes
1 answer

How to capture Packets from Specific Interface in Linux?

Hi@akhtar, You can use tcpdump command in your ...READ MORE

answered Oct 3, 2020 in Linux Administration by MD
• 95,440 points
1,365 views
0 votes
1 answer

How to display captured packets in HEX and ASCII in Linux?

Hi@akhtar, To display the packet value you can ...READ MORE

answered Oct 4, 2020 in Linux Administration by MD
• 95,440 points
25,584 views
0 votes
0 answers

how to grep a specific process from ps in linux?

When I ps -af | grep RV ...READ MORE

Apr 14, 2022 in Linux Administration by Rahul
• 9,670 points
3,274 views
0 votes
0 answers

How to create user in linux by providing uid and gid options?

I have 2 linux machines. On one ...READ MORE

Apr 20, 2022 in Linux Administration by Edureka
• 13,670 points
546 views
0 votes
1 answer
0 votes
1 answer

How do I set variable if a specific package version is installed in CFEngine?

Here is what you can do.Just use packagesmatching to ...READ MORE

answered Jul 12, 2018 in Other DevOps Questions by Atul
• 10,240 points
943 views
+6 votes
17 answers

What are job opportunities as a Linux System Administrator?

I just started working professionally as a ...READ MORE

answered Jul 19, 2018 in Career Counselling by eatcodesleeprepeat
• 4,710 points
10,214 views
0 votes
1 answer

setting a variable output from a bash command

You can use $(command), which in my ...READ MORE

answered Feb 15, 2019 in Linux Administration by DareDev
• 6,890 points
2,165 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP