Linux installation remove Telnet Server and client

Source: Internet
Author: User
Tags sessions

Installing the Telnet package
Telnet-client (or Telnet), this package provides a Telnet client program;
Telnet-server software package, this is the real Telnet server package.

1, first detect whether these packages have been installed
[Email protected] xinetd.d]# Rpm-qa | grep telnet
Telnet-server-0.17-64.el7.x86_64
Telnet-0.17-64.el7.x86_64

2, Telnet-server service start relies on xinetd service,
You need to install first, if the Telnet-server service was installed before xinetd, remove telnet-server before installing xinetd
1) See if the installation
Rpm-qa | grep xinetd
2) Install XINETD service
[Email protected] xinetd.d]# yum-y install xinetd

3. Install or uninstall the package
Get the installed package name based on the command above
Unloading:
[Email protected] xinetd.d]# rpm-e telnet-server-0.17-64.el7.x86_64
[Email protected] xinetd.d]# rpm-e telnet-0.17-64.el7.x86_64

Installation:
Install client: yum-y install Telnet
1) Use the Yum list |grep telnet command to get the source file to find the Telnet-server:
[[email protected]/]# Yum list |grep telnet
telnet.x86_64 1:0.17-64.el7 @base
telnet-server.x86_64 1:0.17-64.el7 @base
dcap-tunnel-telnet.x86_64 2.47.11-1.el7 Epel

2) Install the service side
Yum Install telnet-server.x86_64

4. See if the installation is successful
[Email protected]/]# Rpm-qa | grep telnet
Telnet-server-0.17-64.el7.x86_64
Telnet-0.17-64.el7.x86_64

5. Open Service
After the Telnet service, the default is not to turn on the service, modify the file/etc/xinetd.d/telnet to open the service.
Note: If there is a modification, the first modification, if this file does not exist, you can create your own vim. Modify Disable = yes disable = no
The modified Telnet file is:
# Default:yes
# description:the Telnet Server servestelnet sessions; It uses \
# unencrypted Username/password pairs for authentication.
Service Telnet
{
Flags = Reuse
Socket_type = Stream
wait = no
user = root
Server =/usr/sbin/in.telnetd
Log_on_failure + = USERID
Disable = no
}

6. Post-Installation inspection
[Email protected] xinetd.d]# Rpm-qa | grep xinetd
Xinetd-2.3.15-13.el7.x86_64
[Email protected] xinetd.d]# Rpm-qa | grep telnet
Telnet-0.17-64.el7.x86_64
Telnet-server-0.17-64.el7.x86_64

7. Start Telnet and rely on the XINETD service
Prior to CENTOS7:
Service xinetd restart or/etc/rc.d/init.d/xinetd restart

In the CENTOS7:
Service startup item without XINETD
[Email protected] xinetd.d]# service xinetd restart
Redirecting To/bin/systemctl restart Xinetd.service
[Email protected] xinetd.d]# systemctl restart Xinetd.service
[Email protected] xinetd.d]#

8. View Startup
[Email protected] xinetd.d]# Ps-ef|grep xinetd
Root 14910 1 0 10:01? 00:00:00/usr/sbin/xinetd-stayalive-pidfile/var/run/xinetd.pid
Root 14919 14291 0 10:03 pts/0 00:00:00 grep--color=auto xinetd

9. Test Telnet
[[Email protected] xinetd.d]# Telnet 120.78.144.82
Trying 120.78.144.82 ...
Connected to 120.78.144.82.
Escape character is ' ^] '.

Kernel 3.10.0-693.2.2.el7.x86_64 on an x86_64
Izwz95a6wosz6klzf7o6hcz Login:root
Password:

10. Set up service boot
[Email protected] xinetd.d]# chkconfig--level xinetd on
Note:forwarding request to ' systemctl enable Xinetd.service '.
[Email protected] xinetd.d]# Systemctl enable Xinetd.service
[Email protected] xinetd.d]#

11. View Startup Items
[Email protected] xinetd.d]# chkconfig--list

Note:this output shows SysV services only and does not include native
SYSTEMD Services. SysV configuration data might is overridden by native
SYSTEMD configuration.

If you want to list SYSTEMD services use ' Systemctl list-unit-files '.
To see services enabled on particular target use
' Systemctl list-dependencies [target] '.

Aegis 0:off1:off2:on3:on4:on5:on6:off
Agentwatch 0:off1:off2:on3:on4:on5:on6:off
Netconsole 0:off1:off2:off3:off4:off5:off6:off
Network 0:off1:off2:on3:on4:on5:on6:off

XINETD Based services:
Chargen-dgram:off
Chargen-stream:off
Daytime-dgram:off
Daytime-stream:off
Discard-dgram:off
Discard-stream:off
Echo-dgram:off
Echo-stream:off
Tcpmux-server:off
Telnet:on
Time-dgram:off
Time-stream:off

Issue 1: Always prompt for login incorrect

Kernel 3.10.0-693.2.2.el7.x86_64 on an x86_64
Izwz95a6wosz6klzf7o6hcz Login:root
Password:
Login Incorrect
Workaround:
Note the first line of/etc/pam.d/remote, that is: Auth required pam_securetty.so
---------------------
[email protected] pam.d]# cat remote
#%pam-1.0
#auth Required Pam_securetty.so
Auth Substack Password-auth
Auth include Postlogin
Account Required Pam_nologin.so
Account include Password-auth
Password include Password-auth
# pam_selinux.so Close should be the first session rule
Session Required Pam_selinux.so Close
Session Required Pam_loginuid.so
# pam_selinux.so Open should only is followed by sessions to being executed in the user context
Session Required Pam_selinux.so Open
Session Required Pam_namespace.so
Session optional pam_keyinit.so Force revoke
Session include Password-auth
Session include Postlogin
---------------------------------------------------

Issue 2: Login not successful, firewall settings

Other machines remote Telnet, the login is not successful, may be a firewall problem, modify the firewall settings:
------------------------------------------------------------------------
[Email protected] ~]# NETSTAT-TUNLP
Active Internet connections (only servers)
Proto recv-q send-q Local address Foreign address State Pid/program Name
TCP 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 21434/java
TCP 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1169/sshd
TCP 0 0 127.0.0.1:8005 0.0.0.0:* LISTEN 21434/java
TCP 0 0 0.0.0.0:8009 0.0.0.0:* LISTEN 21434/java
TCP6 0 0::: £ º::* LISTEN 14910/xinetd
TCP6 0 0::: 3306:::* LISTEN 27713/mysqld
UDP 0 0 0.0.0.0:68 0.0.0.0:* 760/dhclient
UDP 0 0 172.18.222.199:123 0.0.0.0:* 859/ntpd
UDP 0 0 127.0.0.1:123 0.0.0.0:* 859/ntpd
UDP 0 0 0.0.0.0:123 0.0.0.0:* 859/ntpd
UDP 0 0 0.0.0.0:2221 0.0.0.0:* 760/dhclient
UDP6 0 0::: 123:::* 859/ntpd
UDP6 0 0::: 52914:::* 760/dhclient
------------------------------------------------
Then use Iptables to modify the settings, save the settings using service Iptables Save, and then service iptables Restart Restart the firewall:
[[email protected] ~]# iptables-i input-p TCP--dport 23-jaccept
[[email protected] ~]# iptables-i input-p UDP--dport 23-jaccept
[[Email protected] ~]# service iptables save--There may be an exception 1
[[Email protected] ~]# service iptables restart--if prompted redirecting ... Or:/bin/systemctl restart Iptables.service
-------------------------------
Exception 1:
[[Email protected] ~]# service Iptables Save
The service command supports only basic LSB actions (start, stop, restart, Try-restart, Reload, force-reload, status). For other actions, please try to use Systemctl.
Solve:
1. Shut down the firewall: [[email protected] etc]# Systemctl stop Firewalld
2. Installation or update service: [[email protected] etc]# Yum install iptables-services
3. Start Iptables:[[email protected] etc]# Systemctl enable iptables
Created symlink From/etc/systemd/system/basic.target.wants/iptables.service to/usr/lib/systemd/system/ Iptables.service.
4. Open Iptables:[[email protected] etc]# systemctl start iptables

[[Email protected] etc]# service Iptables Save
iptables:saving firewall rules to/etc/sysconfig/iptables:[OK]

Linux installation remove Telnet Server and client

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.