Telnet server configuration for CentOS-5.1 server configuration Learning

Source: Internet
Author: User
Tags centos server root access

During this period of time in the CentOS-5.1 server related configuration, also will gradually send some of their own notes and problems encountered in the experiment and solutions.

CentOS-5.1 (192.168.1.87)
Client: FC6 (192.168.1.86) Windows XP (192.168.1.88)

Although telnet plaintext transmission poses a great security risk and is now basically replaced by SSH, it is still necessary to learn more.

Lab name: telnet Server Configuration

1. Install the telnet package (usually two ).

1. telnet-client (or telnet). This package provides the telnet client program;

2. It is the telnet-server software package. This is the real Telnet server software package!

Check whether these software packages are installed before installation. The method is as follows:

[Root @ linuxchao root] # rpm-qa | grep telnet

Telnet-server-0.17-38.e15

If no software package is detected, install it. By default, the telnet software package is installed in CentOS server mode, but the server needs to install the telnet-server software package.

The package can also be downloaded and installed on the network)

I am a CentOS system installed on a hard disk, so I will mount the image after attaching the hard disk partition. The method for installing the CD is similar!

[Root @ linuxchao root] mount/dev/hda6/mnt/da # da is the directory created under/mnt. The hda6 partition is where the centos image is located.

[Root @ linuxchao root] mount-t iso9660-o loop/mnt/da/CentOS-5.1-i386-bin-DVD.iso/mnt/iso # The iso directory is also created by me

[Root @ linuxchao root] cd/mnt/iso/CentOS # This directory is where the rpm package is located

[Root @ linuxchao root] rpm-ivh telnet-server-0.17-38.e15.rpm

The telnet server software package has been installed above. check it now.

[Root @ linuxchao root] # rpm-qa | grep telnet

Telnet-0.17-38.e15

Telnet-server-0.17-38.e15

Ii. Start the telnet Service

1. Start the service

Method 1: Use ntsysv. In the displayed window, select telnet and press OK!

Method 2: edit/etc/xinetd. d/telnet

[Root @ linuxchao root] # vi/etc/xinetd. d/telnet

If you find disable = yes <=, you just need to change "yes" to "no! The service is disabled by default.

Method 3: Use the chkconfig command to directly enable

[Root @ linuxchao root] chkconfig telnet on

2. Activate the service

Telnet is stored under xinetd. Therefore, as long as xinetd is re-activated, the settings in xinetd can be re-read. Therefore, the configured telnet is natural.

It can also be activated.

[Root @ linuxchao root] # service xinetd restart
Or [root @ linuxchao root] #/etc/rc. d/init. d/xinetd restart # This is a more formal method.

Iii. Test services

[Root @ linuxchao root] # telnet localhost

If the configuration is correct, the system prompts you to enter the user name and password of the remote machine.

Login:

Password:

Note: by default, only common users are allowed. Therefore, you can create a common user for testing. However, you can solve the problem of root access through the following methods:

Telnet root User Login
Root cannot connect to the host directly using telnet. Telnet is not very secure. By default, root cannot be allowed to telnet to the Linux host. To

Allow the root user to log on. The following methods are available:

[Root @ linuxchao root] # vi/etc/pam. d/login

# Auth required pam_securetty.so # Add comments to this line!

Or # mv/etc/securetty. bak

In this way, the root user can directly access the Linux host. However, we recommend that you do not do this. You can also switch to the root user after entering the common user, with the root permission!

Iv. Client Access lab

The reason is that for LINUX to improve TELNET security and prevent unauthorized users from using TELNET

Let's take a look at the two errors:

First:

[Root @ linuxchao ~] # Telnet 192.168.1.87

Trying 192.168.1.87...

Telnet: connect to address 192.168.1.87: No route to host

Telnet: Unable to connect to remote host: No route to host

Solution: In this case, the firewall does not allow the telnet service and the connection is blocked. By default, CentOS only supports SSH, so you can enter the custom options and check the password before telnet!

Second

[Root @ test xinetd. d] # telnet 172.25.1.3

Trying 172.25.1.3...

Connected to 172.25.1.3 (172.25.1.3 ).

Escape character is '^]'.

Getnameinfo: localhost: Success

Temporary failure in name resolution: Illegal seek

Connection closed by foreign host.

This is the configuration of the/etc/hosts file.
Solution: I add two IP addresses to the address. The content is as follows:

[Linuxchao @ localhost ~] $ More/etc/hosts

# Do not remove the following line, or various programs

# That require network functionality will fail.

127.0.0.1localhost.localdomainlocalhost

: 1localhost6. localdomain6localhost6

192.168.1.88

192.168.1.86

Note: The client name is not written because it is hard to remember. The content format should be 127.0.0.1 pcname.

Conclusion: remember 1 when using telnet. enable the firewall's limitations on telnet 2. /etc/hosts restrictions on the client 3. note:/etc/hosts. allow and/etc/hosts. two deny files

The content in may restrict access. Here, the LAN test won't be too much.

V. Telnet service restrictions

If you are not satisfied with the original default value, you can change it to a safer mechanism. Assume that Linux is a host and has two network interfaces:

192.168.0.1 and 212.45.16.5 can be set as follows:

# Vi/etc/xinetd. d/telnet

# First, set the loose internal restrictions:

Service telnet

{Disable = no <= the default is to activate the telnet service.

Bind = 212.45.16.5 <= only packets from this adapter are allowed.

Only_from = 212.45.16.0/24 <= only hosts in the 210.45.160.0/24 network segment can come online to use the telnet service.

.....

}

# Restrict external connections

Service telnet
{

Disable = no <= the default is to activate the telnet service.

Bind = 192.168.0.1 <= only packets from this adapter are allowed.

Only_from = 192.168.0.0/16 <= only 192.168.0.0 ~ is allowed ~ 192.168.255.255 This CIDR block comes online using the telnet service.

Only_from = .edu.cn <= repeated settings. Only CERNET can be online!

No_access = 192.168.25. {} <= do not allow these PCs to log on

Access_times =--<= service is only available for these two periods of time every day.

......

}

  1. 2.1.4 configure Telnet
  2. How to Set Telnet in Linux
  3. Telnet solution for failure to log on to the system locally

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.