rules for telnet and ftp

Posted on 2003-11-09
Last Modified: 2010-04-22
I have a server linux redhat and i need to administer it remotely.
I would like to use telnet and ftp but only accept requesting from an specific ip address.  Would be fine if i could use XDMCP also for logging into that machine but restricted to only one address.

How can i use ip tables for that goal ?

Thanks for your time to you all !!

Question by:diordonez
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
LVL 40

Expert Comment

ID: 9710648
If your firewall is set up with a default deny stance (iptables -P INPUT DROP) you can add rules to the INPUT chain like:

iptables -A INPUT -p tcp -s --dport 23 -j ACCEPT
iptables -A INPUT -p tcp -s --dport 20 -j ACCEPT
iptables -A INPUT -p tcp -s --dport 21 -j ACCEPT
iptables -A INPUT -p tcp -s --dport 1024:65535 -j ACCEPT

will allow telnet & ftp access from However, keep in mind that anyone that can see your network traffic can easily extract your username & password from the telnet or ftp sessions. If they are a clever attacker they can then spoof the IP and access your server. It is far better to only use safe protocols (ssh, scp, sftp) for remote administration since everything is encrypted.

BTW, You have tow copies of this question. I'd recommend that you go to the Community Support topic area and ask to have deleted and the points refunded.

Author Comment

ID: 9711410
OK jlevie
you have touched the specific point i need.  What do i got to do in order to implement ssh & sftp.  (Excuse but i don´t know... is ssh an alternative for telnet ? )

And the final question, is secure to use XDMCP for graphical remote login ?
How can i enable this kind of access in iptables.

Could you help me ?
LVL 40

Accepted Solution

jlevie earned 125 total points
ID: 9714846
Most, if not all, Linux systems include OpenSSH as a part of their distribution. So it is likely that your have it available on your server (or can install it from your distro). If you are running a firewall on the remote server you need to allow inbound connections via ssh with:

iptables -A INPUT -p tcp -s --dport 22 -j ACCEPT

The ssh client tool (similar to a telnet session) allows the forwarding of X sessions from the remote to the local system. This means that you can open an ssh connection to the remote and run some X application and have the GUI shown on your local system. This is the preferred method of using X on a remote system.
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

LVL 14

Expert Comment

ID: 9715606
BTW, why use telnet and ftp at all, when you can use ssh, which is oodles more secure?

Author Comment

ID: 9722289
How do i modify those sentences if i need accept ssh and sftp from one only address from outside but all the local address

How do i deny definitively the access for ftp and telnet either from outside or inside.

How do i implemente secure access for pop3 ?
LVL 14

Expert Comment

ID: 9722459
Jlevie already commented on iptables rules for ssh/sftp. Just replace in his example with

Similarly, replace ACCEPT with DROP (and get rid of the -s in Jlevie's example rules for ports 20, 21, and 23 to block telnet and ftp.

Finally, you can use iptables similarly to the above to allow access to pop3 (port 110 - read the iptables man page, this stuff is easy to figure out). But note that pop3 will still send data in the clear if you're not using an SSL-ized pop server or tunnel the pop3 traffic over ssh.

Getting those working, however, is a much larger discussion.

Expert Comment

ID: 9724518
SSH allows you to tunnel other non-secure ports through the encrypted channel.

For instance I forward port 110 from a foreign box across the internet to my local port 110. I use SSH to connect to my the foreign linux server, then point my mail program @ port 110 and I read my email securely.

Author Comment

ID: 9725100
OK guys, thanks to you all.  I´ve download some tools for ssh and sftp and they work very well.  I´ve learned a lot with all your comments and tips.

Warm greetings from Colombia !!

Author Comment

ID: 9772654
I have my las question.

What ports do i have to open in order to use internet.  I have used all about telnet, ftp, ssh and pop, but now i can´t use internet neither do a ping to outside.
LVL 40

Expert Comment

ID: 9779290
If you've ditched telnet and FTP the only inbound firewall rule that you need is:

iptables -A INPUT -p tcp -s --dport 22 -j ACCEPT

Take the others for telnet & FTP out of your rule set.

Featured Post

Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

​Being a Managed Services Provider (MSP) has presented you  with challenges in the past— and by meeting those challenges you’ve reaped the rewards of success.  In 2014, challenges and rewards remain; but as the Internet and business environment evol…
Hello EE, Today we will learn how to send all your network traffic through Tor which is useful to get around censorship and being tracked all together to a certain degree. This article assumes you will be using Linux, have a minimal knowledge of …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question