LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to Enable telnet? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-enable-telnet-759172/)

your_shadow03 10-02-2009 05:46 AM

How to Enable telnet?
 
I have Fedora 9 running as Sendmail Server. I tried to telnet from client machine but reported error like:

Server : 10.14.73.50
Client: 10.14.77.33

FROM CLIENT MACHINE:

Code:

[root@bl ~]# telnet 10.14.73.50 25
Trying 10.14.73.50...
telnet: connect to address 10.14.73.50: Connection refused
telnet: Unable to connect to remote host: Connection refused

FROM SERVER MACHINE:

I tried running :
Code:

[root@Innova ~]# nmap -vv localhost

Starting Nmap 4.53 ( http://insecure.org ) at 2009-10-02 21:39 IST
Initiating SYN Stealth Scan at 21:39
Scanning localhost.localdomain (127.0.0.1) [1714 ports]
Discovered open port 443/tcp on 127.0.0.1
Discovered open port 22/tcp on 127.0.0.1
Discovered open port 80/tcp on 127.0.0.1
Discovered open port 25/tcp on 127.0.0.1
Discovered open port 3306/tcp on 127.0.0.1
Discovered open port 7070/tcp on 127.0.0.1
Discovered open port 139/tcp on 127.0.0.1
Discovered open port 631/tcp on 127.0.0.1
Discovered open port 111/tcp on 127.0.0.1
Discovered open port 445/tcp on 127.0.0.1
Discovered open port 9090/tcp on 127.0.0.1
Completed SYN Stealth Scan at 21:39, 0.09s elapsed (1714 total ports)
Host localhost.localdomain (127.0.0.1) appears to be up ... good.
Interesting ports on localhost.localdomain (127.0.0.1):
Not shown: 1703 closed ports
PORT    STATE SERVICE
22/tcp  open  ssh
25/tcp  open  smtp
80/tcp  open  http
111/tcp  open  rpcbind
139/tcp  open  netbios-ssn
443/tcp  open  https
445/tcp  open  microsoft-ds
631/tcp  open  ipp
3306/tcp open  mysql
7070/tcp open  realserver
9090/tcp open  zeus-admin

Read data files from: /usr/share/nmap
Nmap done: 1 IP address (1 host up) scanned in 0.130 seconds
          Raw packets sent: 1714 (75.416KB) | Rcvd: 3439 (144.460KB)
You have new mail in /var/spool/mail/root
[root@Innova ~]# service telnet restart
telnet: unrecognized service
[root@Innovation1 ~]# rpm -qa telnet
telnet-0.17-42.fc9.i386
[root@Innova ~]#

I dont see Port 23 Open.
That means telnet is not enabled. How Can I enable telnet in my Fedora 9 Box?

lutusp 10-02-2009 05:57 AM

Quote:

Originally Posted by your_shadow03 (Post 3704855)
I have Fedora 9 running as Sendmail Server. I tried to telnet from client machine but reported error like:
Code:

[root@bl ~]# telnet 10.14.73.50 25
Trying 10.14.73.50...
telnet: connect to address 10.14.73.50: Connection refused
telnet: Unable to connect to remote host: Connection refused

I tried running :
Code:

[root@Innova ~]# nmap -vv localhost

Starting Nmap 4.53 ( http://insecure.org ) at 2009-10-02 21:39 IST
Initiating SYN Stealth Scan at 21:39
Scanning localhost.localdomain (127.0.0.1) [1714 ports]
Discovered open port 443/tcp on 127.0.0.1
Discovered open port 22/tcp on 127.0.0.1
Discovered open port 80/tcp on 127.0.0.1
Discovered open port 25/tcp on 127.0.0.1
Discovered open port 3306/tcp on 127.0.0.1
Discovered open port 7070/tcp on 127.0.0.1
Discovered open port 139/tcp on 127.0.0.1
Discovered open port 631/tcp on 127.0.0.1
Discovered open port 111/tcp on 127.0.0.1
Discovered open port 445/tcp on 127.0.0.1
Discovered open port 9090/tcp on 127.0.0.1
Completed SYN Stealth Scan at 21:39, 0.09s elapsed (1714 total ports)
Host localhost.localdomain (127.0.0.1) appears to be up ... good.
Interesting ports on localhost.localdomain (127.0.0.1):
Not shown: 1703 closed ports
PORT    STATE SERVICE
22/tcp  open  ssh
25/tcp  open  smtp
80/tcp  open  http
111/tcp  open  rpcbind
139/tcp  open  netbios-ssn
443/tcp  open  https
445/tcp  open  microsoft-ds
631/tcp  open  ipp
3306/tcp open  mysql
7070/tcp open  realserver
9090/tcp open  zeus-admin

Read data files from: /usr/share/nmap
Nmap done: 1 IP address (1 host up) scanned in 0.130 seconds
          Raw packets sent: 1714 (75.416KB) | Rcvd: 3439 (144.460KB)
You have new mail in /var/spool/mail/root
[root@Innova ~]# service telnet restart
telnet: unrecognized service
[root@Innovation1 ~]# rpm -qa telnet
telnet-0.17-42.fc9.i386
[root@Innova ~]#

That means telnet is not enabled. How Can I enable telnet in my Fedora 9 Box?

1. Install the telnet server:

Code:

# yum install telnet-server
2. Enable it:

Code:

# chkconfig telnet on
# service xinetd restart

But ... you really don't want to use telnet for anything serious. Use SSH instead, for anything but intranet fun & games.

your_shadow03 10-02-2009 08:39 AM

I am using telnet for checking sendmail connectivity.
Do You have other way around apart from this?

Tux-Slack 10-02-2009 09:16 AM

You don't need a telnet server for this. You already have the client and that's it.
You're trying to connect to it too.
telnet IP PORT(25 is sendmail/SMTP)
But your connection gets refused by sendmail for some reason, not because you don't have telnet server installed.

When you run nmap, run it as:
nmap -p 25 10.14.73.50
not localhost, nmap the same IP as you're trying to connect to SMTP.

your_shadow03 10-02-2009 11:39 AM

Thanks Tux-Slack !!!

I tried running from client:

Code:

[root@bl ~]# nmap -p 25 10.14.73.50

Starting nmap 3.70 ( http://www.insecure.org/nmap/ ) at 2009-10-02 16:55 IST
Interesting ports on 10.14.73.50:
PORT  STATE  SERVICE
25/tcp closed smtp

Nmap run completed -- 1 IP address (1 host up) scanned in 0.308 seconds

What could be the reason?
Whenever I send mail through sendmail as:
#echo "hello" | mail -v -s "hi" tuxbuddy@gmail.com

It works !!!

But Why Dont client recognize the server.

Tux-Slack 10-02-2009 12:18 PM

Because that way it tries to send mail over localhost and it works.
I bet your sendmail is listening only on 127.0.0.1
Paste output of command:
netstat -avtpn | grep 25
And your sendmail.mc file.

Or wait, just look for a line similar to:
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
in your sendmail.mc file.
Addr=0.0.0.0 means that the server will listen on all machines network interfaces.
If you want to send mail over your server only from your internal network then change Addr=0.0.0.0 to:
Addr=Servers-Internal-IP
I think it's this one 10.14.73.50 right?
But if you want to send mail over your mail server from outside of your network then leave it 0.0.0.0, but in that case be double sure you're not an open relay.
You can test it with some of these tools
And make sure that your firewall(iptables) allows traffic over TCP port 25 on local and/or public network.

your_shadow03 10-02-2009 12:45 PM

Here is the output:
Code:

[root@Innova ~]# netstat -avtpn | grep 25
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                  LISTEN      25513/mysqld
tcp        0      0 127.0.0.1:25                0.0.0.0:*                  LISTEN      2586/sendmail: acce
tcp        0      0 ::ffff:127.0.0.1:41982      ::ffff:127.0.0.1:25        TIME_WAIT  -
You have new mail in /var/spool/mail/root

Now I have added as you said and now the output becomes:

Code:

[root@Innovation1 mail]# netstat -avtpn | grep 25                              tcp        0      0 0.0.0.0:3306                0.0.0.0:*                  LISTEN      25513/mysqld
tcp        0      0 10.14.73.50:25              0.0.0.0:*                  LISTEN      4198/sendmail: acce


Tux-Slack 10-02-2009 12:47 PM

Are you sure you ran that on the mail server?

your_shadow03 10-02-2009 12:55 PM

Sorry I posted before refreshing.

Now Its Working !!!
Thanks Tux.

Now it shows:
Code:

[root@bl mail]# telnet 10.14.73.50 25
Trying 10.14.73.50...
Connected to 10.14.73.50 (10.14.73.50).
Escape character is '^]'.
220 Innova.intinfra.com ESMTP Sendmail 8.14.2/8.14.2; Sat, 3 Oct 2009 04:55:21 +0530


your_shadow03 10-02-2009 12:59 PM

One Last Query..

Say, Sitting on Client I want to send mail to a user called abhi on the Server.
How can I do that?

Tux-Slack 10-02-2009 01:02 PM

I forgot one thing tho. Sowwee.
Now sendmail wont listen on the localhost.
Minor fix. Just add another line reading:
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

Rebuild .mc file, restart sendmail and both should now work.


To send a mail through your server you need to configure a mail client application, such as thunderbird, add a outgoing SMTP server(your server local IP, port 25 and use proper authentication). Don't know exactly how to send mail with sendmail command from a client, never tried it.

Don't know exactly how your server is configured, but to get a little better idea, I suggest reading through Slackware SMTP AUTH HowTo. You can skip the installing part, because you've already got the MTA installed, and the configuration is pretty much the same deal on all systems running sendmail. It will give you a better insight on how sendmail or should I say, how any MTA works. If you wont understand anything, I will be more than happy, as I'm sure anyone else will be, to answer any possible questions regarding the configuration.

your_shadow03 10-02-2009 01:06 PM

In one of the Other Server its not showing :

Code:

[root@Innovation2 ~]# netstat -avtpn | grep 25
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                  LISTEN      32501/mysqld
tcp        0      0 0.0.0.0:47825              0.0.0.0:*                  LISTEN      -
tcp        0    52 10.14.16.215:22            158.234.236.194:2515        ESTABLISHED 25241/14
tcp        0      0 ::ffff:10.14.16.215:3690    ::ffff:10.14.2.254:1107    ESTABLISHED 12648/svnserve
tcp        0      0 ::ffff:10.14.16.215:3690    ::ffff:10.14.2.254:1103    ESTABLISHED 12645/svnserve
tcp        0      0 ::ffff:10.14.16.215:3690    ::ffff:10.14.227.25:1321    ESTABLISHED 7423/svnserve
tcp        0      0 ::ffff:10.14.16.215:3690    ::ffff:10.14.2.254:2181    ESTABLISHED 11561/svnserve
tcp        0      0 ::ffff:10.14.16.215:3690    ::ffff:10.14.2.254:1115    ESTABLISHED 12663/svnserve
tcp        0      0 ::ffff:10.14.16.215:3690    ::ffff:10.14.2.254:1318    ESTABLISHED 15225/svnserve
tcp        0      0 ::ffff:10.14.16.215:3690    ::ffff:10.14.2.254:1112    ESTABLISHED 12660/svnserve
tcp        0      0 ::ffff:10.14.16.215:3690    ::ffff:10.14.2.254:2656    ESTABLISHED 16527/svnserve
[root@Innovation2 ~]#

May I know why :25 is not shown by the netstat though I started sendmail manually


your_shadow03 10-02-2009 01:09 PM

Done.

Thanks Tux for Fix.
Code:

[root@Innova mail]# netstat -avtpn | grep 25
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                  LISTEN      25513/mysqld
tcp        0      0 127.0.0.1:25                0.0.0.0:*                  LISTEN      4330/sendmail: acce
tcp        0      0 10.14.73.50:25              0.0.0.0:*                  LISTEN      4330/sendmail: acce
tcp        0      0 ::ffff:127.0.0.1:48561      ::ffff:127.0.0.1:25        TIME_WAIT  -


Tux-Slack 10-02-2009 01:11 PM

Quote:

Originally Posted by your_shadow03 (Post 3705300)
In one of the Other Server its not showing :

Code:

[root@Innovation2 ~]# netstat -avtpn | grep 25
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                  LISTEN      32501/mysqld
tcp        0      0 0.0.0.0:47825              0.0.0.0:*                  LISTEN      -
tcp        0    52 10.14.16.215:22            158.234.236.194:2515        ESTABLISHED 25241/14
tcp        0      0 ::ffff:10.14.16.215:3690    ::ffff:10.14.2.254:1107    ESTABLISHED 12648/svnserve
tcp        0      0 ::ffff:10.14.16.215:3690    ::ffff:10.14.2.254:1103    ESTABLISHED 12645/svnserve
tcp        0      0 ::ffff:10.14.16.215:3690    ::ffff:10.14.227.25:1321    ESTABLISHED 7423/svnserve
tcp        0      0 ::ffff:10.14.16.215:3690    ::ffff:10.14.2.254:2181    ESTABLISHED 11561/svnserve
tcp        0      0 ::ffff:10.14.16.215:3690    ::ffff:10.14.2.254:1115    ESTABLISHED 12663/svnserve
tcp        0      0 ::ffff:10.14.16.215:3690    ::ffff:10.14.2.254:1318    ESTABLISHED 15225/svnserve
tcp        0      0 ::ffff:10.14.16.215:3690    ::ffff:10.14.2.254:1112    ESTABLISHED 12660/svnserve
tcp        0      0 ::ffff:10.14.16.215:3690    ::ffff:10.14.2.254:2656    ESTABLISHED 16527/svnserve
[root@Innovation2 ~]#

May I know why :25 is not shown by the netstat though I started sendmail manually


You can't check for listening ports with netstat over network, you need to use nmap to check open ports, but it can be a bloat, perhaps the daemon is listening for the "outside world" but the firewall might be blocking it, so it's always better to check on the server that's running the daemon for listen addresses and ports, because it doesn't matter how much the firewall is blocking it.

your_shadow03 10-02-2009 01:16 PM

I ran the nmap on Machine 10.14.16.215(new Server) and it showed:
Code:

[root@Innovation2 ~]# nmap -vv localhost

Starting Nmap 4.53 ( http://insecure.org ) at 2009-10-02 23:32 IST
Initiating SYN Stealth Scan at 23:32
Scanning localhost.localdomain (127.0.0.1) [1714 ports]
Discovered open port 22/tcp on 127.0.0.1
Discovered open port 80/tcp on 127.0.0.1
Discovered open port 443/tcp on 127.0.0.1
Discovered open port 139/tcp on 127.0.0.1
Discovered open port 977/tcp on 127.0.0.1
Discovered open port 3306/tcp on 127.0.0.1
Discovered open port 631/tcp on 127.0.0.1
Discovered open port 8080/tcp on 127.0.0.1
Discovered open port 2049/tcp on 127.0.0.1
Discovered open port 445/tcp on 127.0.0.1
Discovered open port 8009/tcp on 127.0.0.1
Discovered open port 111/tcp on 127.0.0.1
Completed SYN Stealth Scan at 23:32, 0.08s elapsed (1714 total ports)
Host localhost.localdomain (127.0.0.1) appears to be up ... good.
Interesting ports on localhost.localdomain (127.0.0.1):
Not shown: 1702 closed ports
PORT    STATE SERVICE
22/tcp  open  ssh
80/tcp  open  http
111/tcp  open  rpcbind
139/tcp  open  netbios-ssn
443/tcp  open  https
445/tcp  open  microsoft-ds
631/tcp  open  ipp
977/tcp  open  unknown
2049/tcp open  nfs
3306/tcp open  mysql
8009/tcp open  ajp13
8080/tcp open  http-proxy

Read data files from: /usr/share/nmap
Nmap done: 1 IP address (1 host up) scanned in 0.114 seconds
          Raw packets sent: 1714 (75.416KB) | Rcvd: 3440 (144.504KB)
[root@Innovation2 ~]#

No Idea why its Not showing :25.
I checked with these commands:
Code:

[root@Innovation2 ~]# service iptables status
iptables: Firewall is not running.
[root@Innovation2 ~]#
[root@Innovation2 ~]# setenforce 0
[root@Innovation2 ~]# nmap -vv localhost

Starting Nmap 4.53 ( http://insecure.org ) at 2009-10-02 23:36 IST
Initiating SYN Stealth Scan at 23:36
Scanning localhost.localdomain (127.0.0.1) [1714 ports]
Discovered open port 22/tcp on 127.0.0.1
Discovered open port 80/tcp on 127.0.0.1
Discovered open port 443/tcp on 127.0.0.1
Discovered open port 445/tcp on 127.0.0.1
Discovered open port 2049/tcp on 127.0.0.1
Discovered open port 3306/tcp on 127.0.0.1
Discovered open port 8009/tcp on 127.0.0.1
Discovered open port 111/tcp on 127.0.0.1
Discovered open port 139/tcp on 127.0.0.1
Discovered open port 631/tcp on 127.0.0.1
Discovered open port 8080/tcp on 127.0.0.1
Discovered open port 977/tcp on 127.0.0.1
Completed SYN Stealth Scan at 23:36, 0.08s elapsed (1714 total ports)
Host localhost.localdomain (127.0.0.1) appears to be up ... good.
Interesting ports on localhost.localdomain (127.0.0.1):
Not shown: 1702 closed ports
PORT    STATE SERVICE
22/tcp  open  ssh
80/tcp  open  http
111/tcp  open  rpcbind
139/tcp  open  netbios-ssn
443/tcp  open  https
445/tcp  open  microsoft-ds
631/tcp  open  ipp
977/tcp  open  unknown
2049/tcp open  nfs
3306/tcp open  mysql
8009/tcp open  ajp13
8080/tcp open  http-proxy

Read data files from: /usr/share/nmap
Nmap done: 1 IP address (1 host up) scanned in 0.113 seconds
          Raw packets sent: 1714 (75.416KB) | Rcvd: 3440 (144.504KB)
[root@Innovation2 ~]#



All times are GMT -5. The time now is 01:17 AM.