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 in Linux Administration by datageek
• 3,040 points

edited Jul 16 by datageek 158 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 by Archana
• 5,560 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 in Linux Administration by Gitika
• 25,340 points

edited Jul 2 by Gitika 80 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 in Linux Administration by Omkar
• 67,600 points
103 views
0 votes
1 answer

How to create a symlink in Linux?

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

answered Jan 31 in Linux Administration by Omkar
• 67,600 points
69 views
0 votes
1 answer

How to change permissions of folder and files in folder?

The chmod command is used to set/change the permissions ...READ MORE

answered Jan 31 in Linux Administration by Omkar
• 67,600 points
34 views
0 votes
1 answer

How to find path of software installed in Linux?

There are multiple ways to find the ...READ MORE

answered May 19 in Linux Administration by Rishi
105 views
0 votes
1 answer
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
89 views
+5 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,670 points
712 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 in Linux Administration by DareDev
• 6,810 points
85 views