免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: 一生有你llx
打印 上一主题 下一主题

[服务应用] Linux服务器配置 [复制链接]

论坛徽章:
1
15-16赛季CBA联赛之福建
日期:2018-12-10 14:43:45
31 [报告]
发表于 2018-12-17 08:13 |只看该作者
安装swat
      swat是一个图形化的samba管理软件,可以帮助不熟悉的人去灵活的配置samba服务,
1、安装swat
[root@localhost wj]#yum install -y samba-swat
Dependency Updated:
  libsmbclient.i686 0:3.6.23-51.el6  samba.i686 0:3.6.23-51.el6               
  samba-client.i686 0:3.6.23-51.el6  samba-common.i686 0:3.6.23-51.el6         
  samba-winbind.i686 0:3.6.23-51.el6 samba-winbind-clients.i686 0:3.6.23-51.el6
Complete!
[root@localhost wj]#

2、修改swat配置文件“/etc/xinetd.d/swat”
[root@localhost wj]# gedit /etc/xinetd.d/swat
service swat
{
    port       = 901    //端口号
    socket_type   = stream
    wait       = no
    only_from = 127.0.0.1    //是否只允许本机登录,如果想在其他电脑登录,那么用#注释掉这句话。
    user       = root
    server     = /usr/sbin/swat
    log_on_failure    += USERID
    disable       = no   //这里一定要是no,默认yes
}

3、修改防火墙,添加tcp的901端口
[root@localhost wj]# gedit /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 901 -j ACCEPT
[root@localhost wj]# service iptables restart
iptables:将链设置为政策 ACCEPT:filter nat                [确定]
iptables:清除防火墙规则:                                 [确定]
iptables:正在卸载模块:                                   [确定]
iptables:应用防火墙规则:                                 [确定]
iptables:载入额外模块:nf_conntrack_ftp                   [确定]

4、启动swat服务
[root@localhost wj]# service xinetd start
正在启动xinetd:   

5、在浏览器输入“ip:901”,可以看到一个图形化的管理界面
     

论坛徽章:
1
15-16赛季CBA联赛之福建
日期:2018-12-10 14:43:45
32 [报告]
发表于 2018-12-18 07:35 |只看该作者
本帖最后由 一生有你llx 于 2018-12-18 07:41 编辑

DansGuardian
       DansGuardian可以限制客户端的访问,通过这个软件,我们可以限制哪些网站不可以访问、哪些内容不能下载。

2、安装
[root@localhost wj]# rpm -ivh dansguardian-2.8.0.6-1.2.el5.rf.i386.rpm
warning: dansguardian-2.8.0.6-1.2.el5.rf.i386.rpm: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEY
Preparing...               ########################################### [100%]
   1:dansguardian          ########################################### [100%]

3、修改配置文件“/etc/dansguardian/dansguardian.conf”,搜索“filterport”将端口改为8088。默认是8080,和tomcat冲突。关于proxyport端口,使用的是proxy服务器端口,默认3128,如果你修改了proxy的端口,那么这里也要改成对应的端口。
[root@localhost wj]# gedit /etc/dansguardian/dansguardian.conf
# the port that DansGuardian listens to.
filterport = 8088

4、配置防火墙,打开tcp的8088端口
[root@localhost wj]# gedit /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8088 -j ACCEPT
[root@localhost wj]# service iptables restart
iptables:将链设置为政策 ACCEPT:filter nat                [确定]
iptables:清除防火墙规则:                                 [确定]
iptables:正在卸载模块:                                   [确定]
iptables:应用防火墙规则:                                 [确定]
iptables:载入额外模块:nf_conntrack_ftp                   [确定]

5、启动服务
[root@localhost wj]# service dansguardian start
正在关闭 Web Content Filter (dansguardian):               [确定]
启动 Web Content Filter (dansguardian):                   [确定]

6、修改客户端的代理设置,将代理端口改成dansguardian的端口8088,然后去百度一些内容,不良的网站就被屏蔽了。注意,这里端口必须修改,不可以使用3128.
      
      


7、增加过滤网址。
1)修改配置文件“/etc/dansguardian/bannedsitelist”,在后面追加要过滤的网址。重启服务
[root@localhost wj]# gedit /etc/dansguardian/bannedsitelist
# You will need to edit to add and remove categories you want
news.baidu.com

[root@localhost wj]# service dansguardian restart
正在关闭 Web Content Filter (dansguardian):               [确定]
启动 Web Content Filter (dansguardian):                   [确定]
2)客户端访问百度新闻
      

8、过滤关键字
1)修改配置文件“/etc/dansguardian/bannedphraselist”,在后面追加要过滤的网址。重启服务
[root@localhost wj]# gedit /etc/dansguardian/bannedphraselist
# To block any page with words that contain the string "sex". (ie. sexual)
<sex>

[root@localhost wj]# service dansguardian restart
正在关闭 Web Content Filter (dansguardian):               [确定]
启动 Web Content Filter (dansguardian):                   [确定]
2)使用客户端浏览器搜索sex,发现网页打不开
      
      


9、过滤下载内容
1)修改配置文件“/etc/dansguardian/bannedextentsionlist”,里面默认已经有很多被禁止下载的格式了,如果要去掉某个限制,在前面加#
[root@localhost wj]# gedit /etc/dansguardian/bannedextentsionlist
#Banned extension list
.ade  # Microsoft Access project extension
.adp  # Microsoft Access project
.asx  # Windows Media Audio / Video
.bas  # Microsoft Visual Basic class module
.bat  # Batch file
.cab  # Windows setup file
.chm  # Compiled HTML Help file
.cmd  # Microsoft Windows NT Command script

[root@localhost wj]# service dansguardian restart
正在关闭 Web Content Filter (dansguardian):               [确定]
启动 Web Content Filter (dansguardian):                   [确定]
2)使用客户端浏览器下载一个文件
      

10、查看日志。可以通过日志文件“/var/log/dansguardian/access.log”来分析当前哪些内容被拦截了。
[root@localhost wj]# gedit /var/log/dansguardian/access.log
Sella&utm_term=wkjxxx0913 *DENIED* 禁止的文件扩展名: .exe GET 0
2018.8.15 16:29:07 - 192.168.0.112 http://xiazai.mindmanager.cc/favicon.ico  GET 345
module=&appid=1155&mid=bc7ba9731b77d3e10d329f751e774f1c&userid=0&token=&version=2.6.4&vipType=0&album_id=517209  GET 318

论坛徽章:
1
15-16赛季CBA联赛之福建
日期:2018-12-10 14:43:45
33 [报告]
发表于 2018-12-19 07:37 |只看该作者
安装squid
      proxy就是软件代理或者代理服务器,而squid就是一种常用的proxy服务
1、安装squid
[root@localhost wj]# rpm -qa | grep squid
[root@localhost wj]# yum install -y squid                                                    
Installed:
  squid.i686 7:3.1.10-19.el6_4                                                                                             
Complete!
[root@localhost wj]#

2、设置防火墙,squid默认使用3128端口,用户可以自行修改一些不冲突的端口,之后要在防火墙中添加端口
[root@localhost wj]# gedit /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3128 -j ACCEPT
[root@localhost phpMyAdmin]# service iptables restart
iptables:将链设置为政策 ACCEPT:filter nat                [确定]
iptables:清除防火墙规则:                                 [确定]
iptables:正在卸载模块:                                   [确定]
iptables:应用防火墙规则:                                 [确定]
iptables:载入额外模块:nf_conntrack_ftp                   [确定]
[root@localhost phpMyAdmin]#

3、启动squid服务
[root@localhost wj]# service squid start
正在启动squid:.                                          [确定]
[root@localhost wj]#

4、测试,在浏览器中设置http代理为Linux的ip,端口号3128
      
     随便打开一个网站,可以看到还是能正常访问,说明配置成功


论坛徽章:
1
15-16赛季CBA联赛之福建
日期:2018-12-10 14:43:45
34 [报告]
发表于 2018-12-20 07:12 |只看该作者
Squid缓存
     代理服务器会在本地硬盘设置缓存,这样可以提高网络效率
1修改squid配置文件“/etc/squid/squid.conf”,参数“cache_dir_ufs”就是设置缓存目录的
[root@localhost wj]#gedit /etc/squid/squid.conf
# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs /var/spool/squid 100 16 256    //缓存目录var/spool/squid,大小100M

2、重启squid服务
[root@localhost wj]# service squid start
正在启动 squid:.                                          [确定]
[root@localhost wj]# gedit /etc/squid/squid.conf
[root@localhost wj]# service squid restart
停止 squid:2018/08/15 11:17:31| WARNING cache_mem is larger than total disk cache space!
................                                           [确定]
init_cache_dir /var/spool/squid... 正在启动 squid:.       [确定]
[root@localhost wj]#

3、查看squid缓存目录,其中swap.state会随着访问网页的增多二逐渐增大
[root@localhost wj]# ls -al /var/spool/squid/
总用量 76
drwxr-x---   18 squid squid 4096 8月  15 11:18 .
drwxr-xr-x.  15 root  root  4096 8月  15 10:50 ..
drwxr-x---  258 squid squid 4096 8月  15 11:18 00
drwxr-x---  258 squid squid 4096 8月  15 11:18 01
drwxr-x---  258 squid squid 4096 8月  15 11:18 02
drwxr-x---  258 squid squid 4096 8月  15 11:18 03
drwxr-x---  258 squid squid 4096 8月  15 11:18 04
drwxr-x---  258 squid squid 4096 8月  15 11:18 05
drwxr-x---  258 squid squid 4096 8月  15 11:18 06
drwxr-x---  258 squid squid 4096 8月  15 11:18 07
drwxr-x---  258 squid squid 4096 8月  15 11:18 08
drwxr-x---  258 squid squid 4096 8月  15 11:18 09
drwxr-x---  258 squid squid 4096 8月  15 11:18 0A
drwxr-x---  258 squid squid 4096 8月  15 11:18 0B
drwxr-x---  258 squid squid 4096 8月  15 11:18 0C
drwxr-x---  258 squid squid 4096 8月  15 11:18 0D
drwxr-x---  258 squid squid 4096 8月  15 11:18 0E
drwxr-x---  258 squid squid 4096 8月  15 11:18 0F
-rw-r-----    1 squid squid   52 8月  15 11:18 swap.state
[root@localhost wj]#

4、定期清理缓存
     在squid的缓存目录下,swap.state慢慢的变大,用户需要定时清除这个文件,或者可以做一个计划任务来清除。

论坛徽章:
1
15-16赛季CBA联赛之福建
日期:2018-12-10 14:43:45
35 [报告]
发表于 2018-12-21 07:18 |只看该作者
Squid连接限制
     Squid可以有效的限制连接,指定哪些用户可以连接,指定哪些网站可以访问,这样就可以有效的利用服务器带宽。
1、限制指定网段不能连接。编辑配置文件”/etc/squid/squid.conf”,利用acl语言添加受限制的ip地址
[root@localhost wj]# gedit /etc/squid/squid.conf
acl clientdeny src 192.168.0.1-192.168.0.200
http_access deny clientdeny
[root@localhost wj]# service squid restart
停止squid:................                               [确定]
正在启动squid:.                                          [确定]
     重启squid之后,使用这个代理的浏览器将不能访问任何网页
     

2、限制某个ip不能使用呢,和上面的一样使用acl语法  
[root@localhost wj]# gedit /etc/squid/squid.conf
acl clientdeny src 192.168.0.113
http_access deny clientdeny
[root@localhost wj]# service squid restart
停止squid:................                               [确定]
正在启动squid:.                                          [确定]
     重启squid之后,IP地址为“192.168.0.113”的电脑如果用了这个代理,那么它将不能访问网站
     

3、限制某些网站不能访问
[root@localhost wj]# gedit /etc/squid/squid.conf
acl domaindeny dstdomain .baidu.com
http_access deny domaindeny
[root@localhost wj]# service squid restart
停止 squid:................                               [确定]
正在启动squid:.                                          [确定]
     重启squid之后,使用这个代理的浏览器将不能访问百度
     

4、网站黑名单,可以通过一个网站列表文件形成网站黑名单,这些网站将不能被访问。
     1)在/etc/squid目录下创建爱你一个文件denyurl,在此文件内输入要拦截的网站
[root@localhost wj]# gedit /etc/squid/denyurl
.baidu.com
.hao123.com
[root@localhost wj]# service squid restart
停止squid:................                               [确定]
正在启动squid:.                                          [确定]
    2)修改配置文件“/etc/squid/squid.conf”
[root@localhost wj]# gedit /etc/squid/squid.conf
acl denyurl url_regex "/etc/squid/denyurl"     //注意这个路径就是上面定义的文件路径
http_access deny denyurl
[root@localhost wj]# service squid restart
停止squid:................                               [确定]
正在启动 squid:.                                          [确定]
    3)访问百度和hao123
     

5、限制某个时间段内不能连接  
[root@localhost wj]# gedit /etc/squid/squid.conf
acl timedeny time M 10:00-17:00    //M周一  T周二   W周三   H周四   F周五   A周六    S周日
http_access deny clientdeny
[root@localhost wj]# service squid restart
停止squid:................                               [确定]
正在启动squid:.                                          [确定]
     重启squid之后,使用这个电脑的代理将无法再星期一的10~17点上网
     

论坛徽章:
1
15-16赛季CBA联赛之福建
日期:2018-12-10 14:43:45
36 [报告]
发表于 2018-12-24 06:59 |只看该作者
代理认证
      proxy代理服务被广泛的使用,为了安全起见,可以在服务器上增加一层安全认证机制。这里使用htpasswd建立认证账号和密码
1、创建认证账号和密码
[root@localhost wj]# htpasswd -c /etc/squid/passwd david
New password:
Re-type new password:
Adding password for user david

2、修改认证文件,让其他用户可以读取
[root@localhost wj]# chmod o+r /etc/squid/passwd

3、查看认证服务文件
[root@localhost wj]# rpm -ql squid | grep ncsa_auth
/usr/lib/squid/ncsa_auth       //记住这个地址,下面要用到
/usr/share/man/man8/ncsa_auth.8.gz

4、修改配置文件squid.conf
[root@localhost wj]# gedit /etc/squid/squid.conf
auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/passwd        //账号位置、密码位置
auth_param basic children 5
auth_param basic realm you must author     //欢迎词上面的这三句话必须放在配置文件的开头
acl squid_user proxy_auth REQUIRED        //acl语法
http_access allow squid_user               //只允许认证的人使用

5、测试。重启服务后,用使用这个代理的电脑去上网,会弹窗要求认证
[root@localhost wj]# service squid restart
停止squid:................                               [确定]
正在启动squid:.                                          [确定]
      
      

论坛徽章:
1
15-16赛季CBA联赛之福建
日期:2018-12-10 14:43:45
37 [报告]
发表于 2018-12-25 08:43 |只看该作者
Ssh登录   
       Ssh是建立在应用层和传输层的安全协议,专门为远程登录回话和其他网络服务提供安全性。利用ssh可以有效的防止远程管理中的信息泄露问题,同时ssh传输的数据是经过压缩的,可以加快传输速度。

1、启动sshd服务。Centos默认已经安装了ssh,而且该服务默认是启动的
[root@localhost wj]# rpm -qa | grep ssh
libssh2-1.4.2-1.el6.i686
openssh-askpass-5.3p1-94.el6.i686
openssh-server-5.3p1-94.el6.i686
openssh-clients-5.3p1-94.el6.i686
openssh-5.3p1-94.el6.i686
[root@localhost wj]# service sshd status
openssh-daemon (pid  1634) 正在运行...
[root@localhost wj]#

2、测试登录
[root@localhost wj]# ssh root@192.168.0.119
The authenticity of host '192.168.0.119 (192.168.0.119)' can't be established.
RSA key fingerprint is 36:20:c9:ab:88:1f:47:74:1b:f1:d7:47:55:e0:14:7c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.119' (RSA) to the list of known hosts.
root@192.168.0.119's password:
Last login: Fri Aug 10 14:57:45 2018
already login
[root@localhost ~]# exit
logout
Connection to 192.168.0.119 closed.

3、禁止root登录
      root用户在Linux系统中拥有最高的权利,如果用root用户登录就意味着增大了系统的风险。Ssh默认可以使用root登录,为了安全考虑,我们可以禁止root登录。
      1)修改配置文件“/etc/ssh/sshd_config”,找到“permitRootLogin”将其改为no
[root@localhost wj]# gedit /etc/ssh/sshd_config
PermitRootLogin no    //这里默认是yes,而且已经被注释掉了。取消注释,改为no
[root@localhost wj]# service sshd restart           //重启服务
停止sshd:                                               [确定]
正在启动sshd:                                            [确定]
[root@localhost wj]#
      2)测试,使用root登录,可以看到没有权利
[root@localhost wj]# ssh root@192.168.0.119
root@192.168.0.119's password:
Permission denied, please try again.

4、设置指定用户登录
      有时候为了降低系统风险,我们还会设置指定的用户登录,而其他用户登录就会拒绝。
      1)修改配置文件“/etc/ssh/sshd_config”,在最后追加
[root@localhost wj]# gedit /etc/ssh/sshd_config
AllowUsers david    //允许david登录
[root@localhost wj]# service sshd restart           //重启服务
停止sshd:                                               [确定]
正在启动sshd:                                            [确定]
[root@localhost wj]#
      2)测试,分别使用david和weijie两个用户登录,其中weijie会登录失败
[root@localhost wj]# ssh weijie@192.168.0.119
weijie@192.168.0.119's password:
Permission denied, please try again.
[root@localhost wj]# ssh david@192.168.0.119
david@192.168.0.119's password:
Last login: Wed Aug 15 17:12:59 2018 from 192.168.0.112
already login


论坛徽章:
1
15-16赛季CBA联赛之福建
日期:2018-12-10 14:43:45
38 [报告]
发表于 2018-12-26 09:14 |只看该作者
Ssh配置   
        通过配置文件,我们可以有效的管理ssh
1、空闲时间关闭连接
        1)修改配置文件“/etc/ssh/sshd_config”,设置clientAliveInterval和clientAliveCountMax,注意取消前面的注释
[root@localhost wj]# gedit /etc/ssh/sshd_conf
ClientAliveInterval 10       //超时时间,10s
ClientAliveCountMax 0        //超时次数,0
[root@localhost wj]# service sshd restart           //重启服务
停止sshd:                                               [确定]
正在启动sshd:                                            [确定]
        2)测试超时,登录之后不要进行任何操作,10s之后连接就会关闭
[root@localhost wj]# ssh david@192.168.0.119
david@192.168.0.119's password:
Last login: Thu Aug 16 08:22:25 2018 from 192.168.0.119
already login
[david@localhost ~]$ Connection to 192.168.0.119 closed by remote host.
Connection to 192.168.0.119 closed.
[root@localhost wj]#

2、输入密码超时,关闭连接
        1)修改配置文件“/etc/ssh/sshd_config”,设置参数“LoginGraceTime”
[root@localhost wj]# gedit /etc/ssh/sshd_config
LoginGraceTime 10s    //这里默认是2m,代表2分钟。设置为10s,取消注释
[root@localhost wj]# service sshd restart           //重启服务
停止sshd:                                               [确定]
正在启动sshd:                                            [确定]
        2)测试,登录的时候不输入密码,连接会自动断开
[root@localhost wj]# ssh david@192.168.0.119
david@192.168.0.119's password:
Connection closed by UNKNOWN



论坛徽章:
1
15-16赛季CBA联赛之福建
日期:2018-12-10 14:43:45
39 [报告]
发表于 2018-12-27 07:09 |只看该作者
安装telnet     
  telnet是标准的远程登录协议,历史悠久。但是telnet的对话数据没有加密,甚至用户名和密码都是明文显示,这样的服务风险极大。目前大多数系统多已经不会再安装这个服务了,用户需要自己手动安装

1、安装telnet软件,用户可以将telnet的服务器和客户端都安装
[root@localhost wj]# rpm -qa | grep telnet
[root@localhost wj]# yum install -y telnet-server   //telnet服务器端,允许其他电脑连接
Installed:
  telnet-server.i686 1:0.17-48.el6                                                                                          
Complete!
[root@localhost wj]# yum install -y telnet      //telnet客户端,可以连接其他电脑
Installed:
  telnet.i686 1:0.17-48.el6                                                                                                
Complete!

2、配置telnet,修改配置文件“/etc/xinetd.d/telnet”,将参数disable改为no
[root@localhost wj]#gedit /etc/xinetd.d/telnet
# default: on
# description: The telnet server serves telnet 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  //这个默认是yes,只有改成no才可以启动telnet
}

3、修改端口。telnet默认的端口是23,用户可以修改“/etc/services”文件来改变端口。
[root@localhost wj]# gedit /etc/service
telnet          23/tcp     //为了防止被攻击,一般都不会使用23端口。注意这里的23端口要使用tcpudp两种协议
telnet          23/udp

4、修改防火墙,打开tcp和udp的23端口
[root@localhost wj]# gedit /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 23 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 23 -j ACCEPT
[root@localhost wj]# service iptables restart
iptables:将链设置为政策 ACCEPT:filter nat                [确定]
iptables:清除防火墙规则:                                 [确定]
iptables:正在卸载模块:                                   [确定]
iptables:应用防火墙规则:                                 [确定]
iptables:载入额外模块:nf_conntrack_ftp                   [确定]

5、启动telnet
[root@localhost wj]# service xinetd restart        //telnet依赖xinetd
停止xinetd:                                             [确定]
正在启动xinetd:                                          [确定]

6、测试,在window端连接telnet。注意,不要用root用户登录,默认不允许。
[root@localhost wj]# telnet 192.168.0.119
Trying 192.168.0.119...
Connected to 192.168.0.119.
Escape character is '^]'.
CentOS release 6.5 (Final)
Kernel 2.6.32-431.el6.i686 on an i686
login: david
Password:
Last login: Thu Aug 16 08:24:19 from 192.168.0.119
already login




论坛徽章:
1
15-16赛季CBA联赛之福建
日期:2018-12-10 14:43:45
40 [报告]
发表于 2018-12-28 08:07 |只看该作者

配置telnet     
     通过配置文件,我们可以设置telnet的连接时间、连接数、连接ip等,实现更加安全的连接
1、设置连接时间,参数“access_times”
[root@localhost wj]# gedit /etc/xinetd.d/telnet
service telnet
{
    flags      = REUSE
    socket_type   = stream        
    wait       = no
    user       = root
    server     = /usr/sbin/in.telnetd
    log_on_failure    += USERID
    disable       = no
    access_times = 08:00-09:00 13:00-15:00           //规定允许连接的时间段8~9点,13~15
}
[root@localhost wj]# service xinetd restart         //重启服务
停止xinetd:                                             [确定]
正在启动xinetd:                                          [确定]
[root@localhost wj]# telnet 192.168.0.119           //尝试连接
Trying 192.168.0.119...
Connected to 192.168.0.119.
Escape character is '^]'.
Connection closed by foreign host.                  //连接失败

2、设置连接数,通过参数“instances”可以设置允许的连接数,超过之后就无法再连接了
[root@localhost wj]# gedit /etc/xinetd.d/telnet
service telnet
{
    flags      = REUSE
    socket_type   = stream        
    wait       = no
    user       = root
    server     = /usr/sbin/in.telnetd
    log_on_failure    += USERID
    disable       = no
    instances      = 1                                   //这里设置只允许一个连接,第二个就无法连接了
}
[root@localhost wj]# service xinetd restart         //重启服务
停止xinetd:                                             [确定]
正在启动xinetd:                                          [确定]
[root@localhost wj]# telnet 192.168.0.119          //第一个连接
Connected to 192.168.0.119.
login: david      
Password:
Last login: Thu Aug 16 09:10:22 from 192.168.0.119
already login                                          //成功
[root@localhost wj]# telnet 192.168.0.119        //第二个连接
Connected to 192.168.0.119.
Connection closed by foreign host.                //失败

3、允许/禁止特定的ip或者网段登录,参数“only-from”“no_access”
[root@localhost wj]# gedit /etc/xinetd.d/telnet
service telnet
{
    flags      = REUSE
    socket_type   = stream        
    wait       = no
    user       = root
    server     = /usr/sbin/in.telnetd
    log_on_failure    += USERID
    disable       = no
    only_from  = 192.168.0.113                     //只允许113连接
#   only_from  = 192.168.0.0/24                    //允许1~254连接
#   only_from  = 192.168.0.100-192.168.0.200    //允许100~200连接
#   only_from  = 192.168.0.                        //允许113114连接
#   no_access  = 192.168.0.113                    //禁止113连接,其他写法同上
}

4、允许root连接。只要将文件“/etc/securetty”删除,那么系统读不到这个文件,自然就会永续root登录
[root@localhost wj]# mv /etc/securetty /etc/securetty.bak     //重命名该文件
[root@localhost wj]# service xinetd restart                     //重启服务
停止 xinetd:                                              [确定]
正在启动 xinetd:                                          [确定]
[root@localhost wj]# telnet 192.168.0.119                       //连接
Trying 192.168.0.119...
Connected to 192.168.0.119.
login: root                                                          //使用root用户连接
Password:                                                              
Last login: Thu Aug 16 07:51:45 from 192.168.0.119
already login                                                       //连接成功







您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP