- 论坛徽章:
- 0
|
Redhat 开通 Root 远程登录详解
【1.基础知识】
linux提供服务是由运行在后台的守护程序(daemon)来执行的。
守护进程的工作就是打开1个端口(port),等待(listen)进入的连接。在C/S模式中,如果客户提请了1个连接,守护进程就创建(fork)子
进程来响应这个连接,而父进程继续监听其他服务的请求。
但是,对于系统所提供的每1个服务,如果都必须运行1个监听某个端口连接发生的守护程序,那么通常意味着系统资源的浪费。为此,引入“
扩展的网络守护进程服务程序”xinetd(xinetd internet daemon)。telnet服务也是由xinetd守护的。
【2.telnet、ftp安装】
OS:redhat EnterpriseLinux 5
没有安装 telnetd 或者 vsftpd ,在安装光盘中 进入 Server文件夹下面安装
[root@mylove /]#rpm -ivh telnet*.rpm && rpm -ivh vsftp*.rpm
【3.开放telnet登录权限控制】
3.1 OS:redhat Enterprise 4以下
编辑/etc/pam.d/login文件,放开root用户登录权限控制
[root@myrh4/]# vim /etc/pam.d/login
#%PAM-1.0
#auth required pam_securetty.so
auth required pam_stack.so service=system-auth
auth required pam_nologin.so
account required pam_stack.so service=system-auth
password required pam_stack.so service=system-auth
session required pam_stack.so service=system-auth
session optional pam_console.so
~
~
"/etc/pam.d/login" 8L, 330C 2,1
在auth required pam_securetty.so行前加“#”号注释,注销该行。
3.2 OS:redhat Enterprise 5中的/etc/pam.d/login已经没有那行,不需要修改此文件
[root@mylove /]# vim /etc/pam.d/login 【os RHL5】
#%PAM-1.0
auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so
auth include system-auth
account required pam_nologin.so
account include system-auth
password include system-auth
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session include system-auth
session required pam_loginuid.so
session optional pam_console.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open
session optional pam_keyinit.so force revoke
~
~
3.4 确认/etc/hosts.deny文件中没有all
[root@mylove etc]# more hosts.deny
#
# hosts.deny This file describes the names of the hosts which are
# *not* allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow. In particular
# you should know that NFS uses portmap!
【4.配置telnet服务文件】
[root@mylove /]# vim /etc/xinetd.d/telnet
# default: on
# description: The telnet server serves telnet sessions; it uses \
# unencrypted username/password pairs for authentication.
service telnet
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
}
[root@mylove /]#
将disable=yes行前加#,或者改为disable=no
PS:安装telnet-server后,系统才有文件/usr/sbin/in.telnetd
【5.重新启动xinetd守护进程】
[root@mylove /]#service xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
[root@mylove /]#/etc/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
[root@mylove /]#
【6.关闭系统的防火墙】
[root@mylove etc]# setup
Text Mode Setup Utility 1.19.2 (c) 1999-2006 Red Hat, Inc.
┌────────┤ Choose a Tool ├─────────┐
│ │
│ Authentication configuration │
│ Firewall configuration │
│ Keyboard configuration │
│ Network configuration │
│ System services │
│ Timezone configuration │
│ X configuration │
│ │
│ ┌──────────┐ ┌──────┐ │
│ │ Run Tool │ │ Quit │ │
│ └──────────┘ └──────┘ │
│ │
│ │
└──────────────────────────────────┘
/ between elements | Use to edit a selection
linux系统默认的防火墙是“high”
命令行界面CLI:
选择:“firewall configuration”
选择:security level——“no firewall”
【7.测试】
C:\>telnet 10.10.10.10
Red Hat Enterprise Linux Server release 5 (Tikanga)
Kernel 2.6.18-8.el5 on an i686
login: root
Password: ******
Last login: Thu Jul 9 13:46:43 from 10.10.10.11
[root@mylove ~]#
【8.telnet默认开机启动】
8.1 通过图形界面调整
[root@mylove /]# ntsysv
ntsysv 1.3.30.1 - (C) 2000-2001 Red Hat, Inc.
┌──────────────────┤ Services ├───────────────────┐
│ What services should be automatically started? │
│ │
│ ESMamvmain ↑ │
│ ESMcmn ? │
│ ESMfilesys ? │
│ [ ] ESMlan ? │
│ ESMmlx ? │
│ ESMntserver ? │
│ ESMpowsw ? │
│ ESMsmsrv ↓ │
│ │
│ ┌────┐ ┌────────┐ │
│ │ Ok │ │ Cancel │ │
│ └────┘ └────────┘ │
│ │
│ │
└─────────────────────────────────────────────────┘
Press for more information on a service.
Press for more information on a service.
找到telnet,用空格键激活(*)服务
8.2 确认telnet服务已经运行 命令chkconfig
[root@mylove /]# chkconfig --list telnet
telnet on
8.3 图形用户界面GUI
“主菜单”——“系统设置”——“服务器设置”——“服务”
从第 6、7、8 步来看,你的 OS 是 RedHat,那么,你第 3 步就是多余的了
【简明路线】
1、找到发行版光盘上的 telnet-server-xxx.rpm,安装好
2、ntsysv,把 telnet 和 xinted 选上,这样可以保证系统下次启动自动开启服务
3、service xinted start,来手动启动 telnet 服务(前提是 ntsysv 里面选择了 telnet)
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/99388/showart_1990719.html |
|