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,070 points

edited Jul 16, 2019 by datageek 5,444 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!

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,870 points

edited Jul 2, 2019 by Gitika 396 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,140 points
120 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,140 points
83 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,140 points
203 views
–1 vote
1 answer

How to get octal file permission in linux?

You can use this: stat -c "%a %n" ...READ MORE

answered Jan 3, 2019 in Linux Administration by Omkar
• 69,110 points
621 views
0 votes
1 answer

How to create a symlink in Linux?

To create a symbolic link, you can ...READ MORE

answered Jan 31, 2019 in Linux Administration by Omkar
• 69,110 points
245 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
291 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 18, 2018 in Career Counselling by eatcodesleeprepeat
• 4,770 points
4,194 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
1,000 views