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

edited Jul 16, 2019 by datageek 695 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,600 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
• 25,460 points

edited Jul 2, 2019 by Gitika 100 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
• 68,880 points
157 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
• 68,880 points
86 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, 2019 in Linux Administration by Omkar
• 68,880 points
49 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, 2019 in Linux Administration by Rishi
272 views
0 votes
1 answer

How to convert DOS line endings to Linux line endings in vim?

try this; :%s/\r/\r/g READ MORE

answered May 24, 2019 in Linux Administration by Upasana
• 8,570 points
73 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,250 points
111 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,750 points
833 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,850 points
114 views