亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
最近訪問(wèn)板塊 發(fā)新帖
樓主: 一生有你llx
打印 上一主題 下一主題

[服務(wù)應(yīng)用] Linux服務(wù)器配置 [復(fù)制鏈接]

論壇徽章:
1
15-16賽季CBA聯(lián)賽之福建
日期:2018-12-10 14:43:45
21 [報(bào)告]
發(fā)表于 2018-12-05 20:01 |只看該作者
安裝vsftpd
      大多數(shù)Linux系統(tǒng)都使用vsftpd,因此這里我們也安裝vsftpd
1、安裝vsftpd
[root@localhost phpMyAdmin]# yum install -y vsftpd
Loaded plugins: fastestmirror, refresh-packagekit, security
Installed:
  vsftpd.i686 0:2.2.2-11.el6_4.1                                                      
Complete!
[root@localhost phpMyAdmin]#

2、設(shè)置防火墻,vsftpd默認(rèn)使用21端口,因此必須在防火墻中設(shè)置允許訪問(wèn)21端口
     1)在終端輸入命令“setup”,在彈出的框中選擇“防火墻”,接著選擇“定制”
      
     2)使用空格鍵選中”ftp”,接著選擇“轉(zhuǎn)發(fā)”
      
     3)選擇“添加“
      
     4)添加端口21,協(xié)議tcp,然后確定
      
     5)回到最初的界面,“確定”
      
     6)重啟防火墻
[root@localhost phpMyAdmin]# service iptables restart
iptables:將鏈設(shè)置為政策 ACCEPT:filter nat                [確定]
iptables:清除防火墻規(guī)則:                                 [確定]
iptables:正在卸載模塊:                                   [確定]
iptables:應(yīng)用防火墻規(guī)則:                                 [確定]
iptables:載入額外模塊:nf_conntrack_ftp                   [確定]
[root@localhost phpMyAdmin]#

3、啟動(dòng)vsftpd
[root@localhost bin]# service vsftpd start
為 vsftpd 啟動(dòng)vsftpd:                                    [確定]

4、測(cè)試
     1)安裝lftp
[root@localhost phpMyAdmin]# yum install -y lftp
Installed:
  lftp.i686 0:0.17-54.el6                                                            
Complete!
     2)連接ftp
[root@localhost bin]# lftp 192.168.0.113
lftp 192.168.0.113:~> ls
drwxr-xr-x    2 0       0            4096 Mar 01  2013 pub
lftp 192.168.0.113:/> cd pub
lftp 192.168.0.113:/pub> ls
lftp 192.168.0.113:/pub>

5、修改端口。ftp默認(rèn)端口是21,但是很多時(shí)候都會(huì)改變端口,這是就需要修改配置文件“/etc/vsftpd/vsftpd.conf”,在結(jié)尾追加一句”listen_port=8765”。
[root@localhost pub]# gedit /etc/vsftpd/vsftpd.conf
listen_port=8765

6、重啟服務(wù)測(cè)試。請(qǐng)先按照第二步修改防火墻配置
[root@localhost ~]# service vsftpd restart
關(guān)閉vsftpd:                                             [確定]
為 vsftpd 啟動(dòng)vsftpd:                                    [確定]

[root@localhost ~]# lftp 192.168.0.113      //按照默認(rèn)的端口來(lái)連接
lftp 192.168.0.113:~> ls                      //使用ls命令,發(fā)現(xiàn)根本沒(méi)有連接上
中斷                                    
lftp 192.168.0.113:~>

[root@localhost ~]# lftp 192.168.0.113:8765        //連接的時(shí)候指定端口號(hào)
lftp 192.168.0.113:~> ls                              //使用ls命令可以查看內(nèi)容,說(shuō)明連接成功
drwxr-xr-x    2 0        0            4096 Aug 14 03:38 pub


論壇徽章:
1
15-16賽季CBA聯(lián)賽之福建
日期:2018-12-10 14:43:45
22 [報(bào)告]
發(fā)表于 2018-12-07 08:51 |只看該作者
ftp限制IP
1、通過(guò)vsftpd的配置文件以及“hosts.deny”和“hosts.allow”文件設(shè)置允許某個(gè)ip地址訪問(wèn)
      1)修改配置文件“/etc/vsftpd/vsftpd.conf”中的參數(shù)“tcp_wrapper”,確保這個(gè)參數(shù)是yes
[root@localhost wj]# gedit /etc/vsftpd/vsftpd.conf        //匿名登錄
tcp_wrapper=YES
      2)打開(kāi)配置文件“/etc/hosts.deny“,在末尾追加一句話”vsftpd:alleny“
[root@localhost wj]# gedit /etc/hosts.deny
# hosts.deny  This file contains access rules which are used to
#      deny connections to network services that either use
#      the tcp_wrappers library or that have been
#      started through a tcp_wrappers-enabled xinetd.
#
#      The rules in this file can also be set up in
#      /etc/hosts.allow with a 'deny' option instead.
#
#      See 'man 5 hosts_options' and 'man 5 hosts_access'
#      for information on rule syntax.
#      See 'man tcpd' for information on tcp_wrappers
#
vsftpd:alleny       //所有的ip都不可以訪問(wèn)
      3)打開(kāi)配置文件“/etc/hosts.allow“,在末尾追加一句話”vsftpd:192.168.0.123:Allow“。當(dāng)前的配置就是只允許“192.168.0.123”訪問(wèn)
[root@localhost wj]# gedit /etc/hosts.allow
# hosts.allow This file contains access rules which are used to
#      allow or deny connections to network services that
#      either use the tcp_wrappers library or that have been
#      started through a tcp_wrappers-enabled xinetd.
#
#      See 'man 5 hosts_options' and 'man 5 hosts_access'
#      for information on rule syntax.
#      See 'man tcpd' for information on tcp_wrappers
#
vsftpd:192.168.0.123:Allow
      4)測(cè)試是否可以訪問(wèn),當(dāng)前主機(jī)的ip并不是“192.168.0.123”,因此訪問(wèn)不會(huì)成功的
[root@localhost wj]# service vsftpd restart        //重啟服務(wù)
關(guān)閉vsftpd:                                             [確定]
為 vsftpd 啟動(dòng)vsftpd:                                    [確定]
[root@localhost wj]# lftp weijie:123456@192.168.0.113:8765     //本地用戶登錄
中斷                                                                     //ls失敗,并沒(méi)有連接成功
[root@localhost wj]# lftp 192.168.0.113:8765                     //匿名登錄
lftp 192.168.0.113:~> ls
中斷                                                                     //ls失敗,并沒(méi)有連接成功
lftp 192.168.0.113:~>

2、當(dāng)一個(gè)ip地址對(duì)主機(jī)的連接太多時(shí),就會(huì)降低服務(wù)器的效率。因此有必要設(shè)置一個(gè)IP的連接數(shù),當(dāng)連接超過(guò)一定的數(shù)量就不能再連了,這樣就可以提高服務(wù)器的效率。Vsftpd默認(rèn)沒(méi)有連接設(shè)置,可以通過(guò)參數(shù)“max_clients“來(lái)設(shè)置。由于同一個(gè)局域網(wǎng)的ip是一樣的,因此這個(gè)最大連接數(shù)要合理設(shè)置。
      1)打開(kāi)配置文件“/etc/vsftpd/vsftpd.conf“,在末尾追加一句話”max_clients=2“
[root@localhost pub]# gedit /etc/vsftpd/vsftpd.conf
max_clients=2
      2)重啟服務(wù),測(cè)試。一次打開(kāi)三個(gè)連接,發(fā)現(xiàn)第三個(gè)連接不能訪問(wèn)
[root@localhost wj]# service vsftpd restart        //重啟服務(wù)
關(guān)閉vsftpd:                                             [確定]
為 vsftpd 啟動(dòng)vsftpd:                                    [確定]
[root@localhost wj]# lftp weijie:123456@192.168.0.113:8765        //登錄weijie
-rwxrwxrwx    1 0        0        2375494044 Aug 14 07:13 1.zip
[root@localhost wj]# lftp 192.168.0.113:8765                       //匿名登錄
lftp 192.168.0.113:~> ls
drwxr-xr-x    2 0        0            4096 Aug 14 06:38 pub
lftp 192.168.0.113:/>
[root@localhost pub]# lftp 192.168.0.113                          //匿名登錄
lftp 192.168.0.113:~> ls
[0] ls &                                 
    `ls' at 0 [重新連接前延時(shí): 22]                                  //不能再訪問(wèn),ls失效
lftp 192.168.0.113:~>


論壇徽章:
1
15-16賽季CBA聯(lián)賽之福建
日期:2018-12-10 14:43:45
23 [報(bào)告]
發(fā)表于 2018-12-09 07:39 |只看該作者
用戶黑白名單
      一個(gè)Linux主機(jī)中會(huì)多個(gè)用戶,而我們希望有些用戶不能去訪問(wèn)ftp。ftp服務(wù)器可以通過(guò)配置文件“/etc/vsftpd/user_list”來(lái)設(shè)置一個(gè)用戶列表,這個(gè)列表可以是黑名單,也可以是白名單,具體要根據(jù)配置文件的參數(shù)“userlist_deny”來(lái)確定

1、黑名單
      1)修改配置文件“/etc/vsftpd/vsftpd.conf”中的參數(shù)“userlist_enable”,確保這個(gè)參數(shù)是yes
[root@localhost wj]# gedit /etc/vsftpd/vsftpd.conf        //匿名登錄
userlist_enable=YES
      2)打開(kāi)配置文件“/etc/vsftpd/vsftpd.conf“,在末尾追加一句話”userlist_deny=yes“。這個(gè)參數(shù)是yes,表示要設(shè)置一個(gè)黑名單
[root@localhost wj]# lftp david:543092@192.168.0.113:8765    //用戶david登錄,密碼是543092
userlist_deny=YES
      3)編輯文件“/etc/vsftpd/user_list“,在末尾追加一句話要設(shè)置的用戶名即可
[root@localhost ~]#gedit /etc/vsftpd/user_list
# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# for users that are denied.
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody
david
      4)重啟服務(wù),測(cè)試黑名單內(nèi)的用戶是否可以訪問(wèn),上面列出的都是不可以訪問(wèn)的用戶
[root@localhost wj]# service vsftpd restart        //重啟服務(wù)
關(guān)閉vsftpd:                                             [失敗]
為 vsftpd 啟動(dòng)vsftpd:                                    [確定]
[root@localhost wj]# lftp weijie:123456@192.168.0.113:8765     //用戶weijie登錄,可以訪問(wèn)
-rwxrwxrwx    1 0        0        2375494044 Aug 14 07:13 1.zip
[root@localhost wj]# lftp 192.168.0.113:8765                //匿名用戶也可以
lftp 192.168.0.113:~> ls
drwxr-xr-x    2 0        0            4096 Aug 14 06:38 pub
lftp 192.168.0.113:/>
[root@localhost wj]# lftp david:543092@192.168.0.113:8765    //用戶david在黑名單中,因此無(wú)法訪問(wèn),ls命令會(huì)失敗
[0] ls &                                 
    `ls' at 0 [重新連接前延時(shí): 28]

2、白名單
      1)修改配置文件“/etc/vsftpd/vsftpd.conf”中的參數(shù)“userlist_enable”,確保這個(gè)參數(shù)是yes
[root@localhost wj]# gedit /etc/vsftpd/vsftpd.conf        //匿名登錄
userlist_enable=YES
      2)打開(kāi)配置文件“/etc/vsftpd/vsftpd.conf“,在末尾追加一句話”userlist_deny=NO“。這個(gè)參數(shù)是NO,表示要設(shè)置一個(gè)白名單
[root@localhost wj]# lftp david:543092@192.168.0.113:8765    //用戶david登錄,密碼是543092
userlist_deny=NO
      3)編輯文件“/etc/vsftpd/user_list“,在末尾追加一句話要設(shè)置的用戶名即可
[root@localhost ~]#gedit /etc/vsftpd/user_list
# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# for users that are denied.
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody
david
      4)重啟服務(wù),測(cè)試黑名單內(nèi)的用戶是否可以訪問(wèn),上面列出的都是不可以訪問(wèn)的用戶
[root@localhost wj]# service vsftpd restart        //重啟服務(wù)
關(guān)閉vsftpd:                                             [失敗]
為 vsftpd 啟動(dòng)vsftpd:                                    [確定]
[root@localhost wj]# lftp david:543092@192.168.0.113:8765     //用戶david登錄,可以訪問(wèn)
-rwxrwxrwx    1 0        0        2375494044 Aug 14 07:13 1.zip
[root@localhost wj]# lftp weijie:123456@192.168.0.113:8765    //用戶weijie不在白名單中,因此無(wú)法訪問(wèn),ls命令會(huì)失敗
[0] ls &                                 
    `ls' at 0 [重新連接前延時(shí): 28]
[root@localhost wj]# lftp 192.168.0.113:8765         //匿名用戶也不行
lftp 192.168.0.113:~> ls
[0] ls &                                 
    `ls' at 0 [重新連接前延時(shí): 28]
lftp 192.168.0.113:~>


論壇徽章:
1
15-16賽季CBA聯(lián)賽之福建
日期:2018-12-10 14:43:45
24 [報(bào)告]
發(fā)表于 2018-12-10 14:53 |只看該作者
FTP其他配置
      在配置文件中,還有一些關(guān)于vsftpd的其他設(shè)置,這里列出來(lái)
# Example config file /etc/vsftpd/vsftpd.conf
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES       //是否允許匿名登錄
#
# Uncomment this to allow local users to log in.
local_enable=YES         //是否允許本地用戶登錄
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES        //是否允許寫(xiě)操作
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022      //本地用農(nóng)戶權(quán)限掩碼
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES     //是否允許匿名用戶上傳
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES    //是否允匿名用戶創(chuàng)建目錄
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES    //是否允許獲取目錄信息
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES        //是否允許其他用戶擁有匿名用戶上傳的文件
#chown_username=whoever
# You may change the default value for timing out an idle session.
#idle_session_timeout=600    //連接空閑超時(shí)
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120    //數(shù)據(jù)請(qǐng)求超時(shí)
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES    //是否允許ls命令使用-R參數(shù),遞歸
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
#chroot_local_user=YES    //是否允許用戶切換目錄
#chroot_list_enable=YES    //是否允許指定的用戶切換目錄,用戶名單在/etc/vsftpd/chroot_list文件中
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list  //這個(gè)文件中的用戶不能切換目錄


論壇徽章:
1
15-16賽季CBA聯(lián)賽之福建
日期:2018-12-10 14:43:45
25 [報(bào)告]
發(fā)表于 2018-12-11 10:42 |只看該作者
安裝bind
1、安裝bind軟件,需要安裝3 個(gè)bind、bind-chroot、bind-util
[root@localhost pub]# yum install -y bind bind-chroot bind-utils
Installed:
  bind.i686 32:9.8.2-0.17.rc1.el6_4.6                                                                                    
Complete!

2、修改配置文件“/etc/named.conf”,追加“forward”
[root@localhost pub]# gedit /etc/named.conf
options {
    listen-on port 53 { 127.0.0.1; };
#   listen-on-v6 port 53 { ::1; };
    directory "/var/named";
    dump-file "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
    allow-query     { localhost; };
    recursion yes;
    dnssec-enable yes;
    dnssec-validation yes;
    dnssec-lookaside auto;
    /* Path to ISC DLV key */
    bindkeys-file "/etc/named.iscdlv.key";
    managed-keys-directory "/var/named/dynamic";
    forward only;
    forwarders{
       8.8.8.8;   
    }
};

3、設(shè)置防火墻,這里需要用到53端口。需要開(kāi)啟tcp和udp的53端口,記得重啟防火墻
[root@localhost pub]# gedit /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 53 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 53 -j ACCEPT
[root@localhost phpMyAdmin]# service iptables restart
iptables:將鏈設(shè)置為政策 ACCEPT:filter nat                [確定]
iptables:清除防火墻規(guī)則:                                 [確定]
iptables:正在卸載模塊:                                   [確定]
iptables:應(yīng)用防火墻規(guī)則:                                 [確定]
iptables:載入額外模塊:nf_conntrack_ftp                   [確定]
[root@localhost phpMyAdmin]#

4、啟動(dòng)服務(wù)
[root@localhost pub]# service named start
啟動(dòng)named:                                              [確定]
[root@localhost pub]#

5、測(cè)試,命令格式“dig 網(wǎng)站@ip”,這里用回環(huán)地址來(lái)測(cè)試,看是否能請(qǐng)求成功
[root@localhost pub]# dig www.baidu.com @127.0.0.1
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> www.baidu.com @127.0.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51491
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.baidu.com.          IN  A
;; ANSWER SECTION:
www.baidu.com.       1191   IN  CNAME  www.a.shifen.com.
www.a.shifen.com. 299IN  A   14.215.177.38      //這個(gè)就是請(qǐng)求到的結(jié)果
www.a.shifen.com. 299IN  A   14.215.177.39
;; Query time: 3053 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Aug 14 19:02:59 2018
;; MSG SIZE  rcvd: 90

6、更改配置文件named.conf,讓所有機(jī)器都可以使用該服務(wù)。
1)將配置文件中的回環(huán)地址改為any,意味著允許任何人使用
[root@localhost pub]# gedit /etc/named.conf
options {
    listen-on port 53 {any; };
#   listen-on-v6 port 53 { ::1; };
    directory "/var/named";
    dump-file "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
    allow-query     { any; };
    recursion yes;
    dnssec-enable yes;
    dnssec-validation yes;
    dnssec-lookaside auto;
    /* Path to ISC DLV key */
    bindkeys-file "/etc/named.iscdlv.key";
    managed-keys-directory "/var/named/dynamic";
    forward only;
    forwarders{
       8.8.8.8;   
    }
};
2)找一個(gè)其他ip地址來(lái)測(cè)試
[root@localhost pub]# service named restart   //重啟服務(wù)
停止named:                                              [確定]
啟動(dòng)named:                                              [確定]
[root@localhost pub]# dig www.baidu.com @192.168.0.113
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> www.baidu.com @192.168.0.113
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37134
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.baidu.com.          IN  A
;; ANSWER SECTION:
www.baidu.com.       871 IN  CNAME  www.a.shifen.com.
www.a.shifen.com. 299 IN  A   14.215.177.39
www.a.shifen.com. 299 IN  A   14.215.177.38
;; Query time: 474 msec
;; SERVER: 192.168.0.113#53(192.168.0.113)
;; WHEN: Tue Aug 14 19:06:19 2018
;; MSG SIZE  rcvd: 90


論壇徽章:
1
15-16賽季CBA聯(lián)賽之福建
日期:2018-12-10 14:43:45
26 [報(bào)告]
發(fā)表于 2018-12-12 15:43 |只看該作者
配置bind
1、確定已經(jīng)安裝bind軟件,需要安裝3 個(gè)bind、bind-chroot、bind-util
[root@localhost wj]# yum install y bind bind-chroot bind-util

2、修改配置文件“/etc/named.conf”
[root@localhost pub]# gedit /etc/named.conf
options {
#   listen-on port 53 { 127.0.0.1; };
#   listen-on-v6 port 53 { ::1; };
    directory "/var/named";
    。。。
};
。。。。
zone "david.cn" IN{      //正向解析配置
    type master;
    file "david.cn";    //注意名字,后面要用到這個(gè)名字
    allow-update {none;};
};
zone "0.168.192.in-addr.arpa" IN{   //反向解析配置
    type master;
    file "192.168.0";   //注意名字,后面要用到這個(gè)名字
    allow-update {none;};
};

3、編輯正向配置文件“/var/named/david.cn”,這個(gè)文件不存在,用戶需要自己創(chuàng)建
[root@localhost pub]# gedit /var/named/david.cn
$TTL 86400
@   IN  SOAbind.david.cn. root.david.cn. (
    2011071001
    3600
    1800
    604800
    86400
)
    IN NS      bind.david.cn.
    IN A       192.168.0.113     //這個(gè)是本機(jī)ip
    IN MX 10   mailsrv.david.cn.
bind   IN A       192.168.0.113
mailsrv IN A  192.168.0.250
www IN CNAME   bind.david.cn.

4、編輯反向配置文件“/var/named/192.168.0”,這個(gè)文件不存在,用戶需要自己創(chuàng)建
[root@localhost pub]# gedit /var/named/192.168.0
$TTL 86400
@   IN  SOAbind.david.cn. root.david.cn. (
    2011071001
    3600      
    1800      
    604800     
    86400      
)
    IN NS      bind.david.cn.
    IN PTR david.cn.
    IN A       255.255.255.0
113    IN PTRbind.david.cn.
250 IN PTRmailsrv.david.cn

5、重啟服務(wù)(確保防火墻的53端口已經(jīng)打開(kāi))
[root@localhost wj]# service named restart
停止named:                                              [確定]
啟動(dòng)named:                                              [確定]
[root@localhost wj]#

6、測(cè)試
[root@localhost wj]# nslookup
> server 192.168.0.113          //切換dns服務(wù)器為上面配置好的
Default server: 192.168.0.113
Address: 192.168.0.113#53
> bind.david.cn               //正向解析A類型
Server:       192.168.0.113
Address:   192.168.0.113#53
Name:  bind.david.cn
Address: 192.168.0.113
> mailsrv.david.cn        //正向解析A類型
Server:       192.168.0.113
Address:   192.168.0.113#53
Name:  mailsrv.david.cn
Address: 192.168.0.250
> set q=mx             //正向解析MX類型
> david.cn
Server:       192.168.0.113
Address:   192.168.0.113#53
david.cn   mail exchanger = 10 mailsrv.david.cn.
> www.david.cn     //正向解析CNAME類型
Server:       192.168.0.113
Address:   192.168.0.113#53
www.david.cn  canonical name = bind.david.cn.
> 192.168.0.113     //反向解析
Server:       192.168.0.113
Address:   192.168.0.113#53
113.0.168.192.in-addr.arpa  name = bind.david.cn.
> 192.168.0.250       //反向解析
Server:       192.168.0.113
Address:   192.168.0.113#53
250.0.168.192.in-addr.arpa  name = mailsrv.david.cn.0.168.192.in-addr.arpa.
>


論壇徽章:
1
15-16賽季CBA聯(lián)賽之福建
日期:2018-12-10 14:43:45
27 [報(bào)告]
發(fā)表于 2018-12-13 07:33 |只看該作者
安裝samba  
1、檢測(cè)samba是否安裝,如果沒(méi)有,那么可以使用yum來(lái)安裝。至少需要安裝3個(gè)軟件:samba,samba-client、samba-common
[root@localhost pub]# rpm -qa | grep samba
samba-winbind-clients-3.6.9-164.el6.i686
samba-client-3.6.9-164.el6.i686
samba-common-3.6.9-164.el6.i686
samba4-libs-4.0.0-58.el6.rc4.i686
samba-winbind-3.6.9-164.el6.i686
[root@localhost pub]# yum install y samba samba-client samba-common    //如果沒(méi)有,那么可以用此命令安裝

2、創(chuàng)建共享目錄
[root@localhost /]# mkdir /wj        //創(chuàng)建目錄
[root@localhost /]# chmod 777 /wj   //設(shè)置權(quán)限

3、修改配置文件“/etc/samba/smb.cnf”
[root@localhost /]#gedit /etc/samba/smb.conf
# ----------------------- Standalone Server Options ------------------------
# Scurity can be set to user, share(deprecated) or server(deprecated)
# Backend to store user information in. New installations should
# use either tdbsam or ldapsam. smbpasswd is available for backwards
# compatibility. tdbsam requires no further configuration
    security = share           //這里默認(rèn)是user,改為share,這樣不用輸入密碼就可訪問(wèn)
    passdb backend = tdbsam
    [wj]                //創(chuàng)建共享目錄配置
    comment=wj       //名字
    path=/wj         //路徑
    read only=no    //是否只讀,這里為no,這樣用戶就可以創(chuàng)建文件夾
    guest ok=yes    //是否允許guest用戶登錄
    browseable=yes //是否可以瀏覽目錄

4、修改防火墻,打開(kāi)tcp的端口137、138、139、445
[root@localhost wj]# gedit /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 137 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
[root@localhost wj]# service iptables restart
iptables:將鏈設(shè)置為政策 ACCEPT:filter nat                [確定]
iptables:清除防火墻規(guī)則:                                 [確定]
iptables:正在卸載模塊:                                   [確定]
iptables:應(yīng)用防火墻規(guī)則:                                 [確定]
iptables:載入額外模塊:nf_conntrack_ftp                   [確定]

5、啟動(dòng)smb服務(wù)
[root@localhost wj]# service smb start
啟動(dòng) SMB 服務(wù):                                            [確定]

6、測(cè)試,在終端輸入命令“testparm”,可以看到共享目錄的信息
[root@localhost wj]# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[wj]"
WARNING: The security=share option is deprecated
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[global]
    workgroup = MYGROUP
    server string = Samba Server Version %v
    security = SHARE
    log file = /var/log/samba/log.%m
    max log size = 50
    idmap config * : backend = tdb
    cups options = raw
[homes]
    comment = Home Directories
    read only = No
    browseable = No
[printers]
    comment = All Printers
    path = /var/spool/samba
    printable = Yes
    print ok = Yes
    browseable = No
[wj]
    comment = wj            //名字
    path = /wj              //路徑
    read only = No         //是否只讀
    guest ok = Yes         //是否允許guest訪問(wèn)
7、從windows測(cè)試,按下快捷鍵“window+r”,在彈出的窗口輸入命令“smb:\\192.168.0.113”,可以看到本機(jī)的共享目錄
     
     

論壇徽章:
1
15-16賽季CBA聯(lián)賽之福建
日期:2018-12-10 14:43:45
28 [報(bào)告]
發(fā)表于 2018-12-14 08:49 |只看該作者
配置samba使用用戶名和密碼登錄   
1、當(dāng)samba配置文件中的secure設(shè)置為user的時(shí)候,需要正確的用戶名和密碼才能登錄。
root@localhost /]#gedit /etc/samba/smb.conf
# ----------------------- Standalone Server Options ------------------------
# Scurity can be set to user, share(deprecated) or server(deprecated)
# Backend to store user information in. New installations should
# use either tdbsam or ldapsam. smbpasswd is available for backwards
# compatibility. tdbsam requires no further configuration
    security = user           //這是默認(rèn)值,需要用戶名密碼
    passdb backend = tdbsam

2、管理賬戶和密碼
     samba默認(rèn)使用tdbsam數(shù)據(jù)庫(kù)管理機(jī)制來(lái)統(tǒng)一管理用戶名和密碼,使用的命令是pdbedit,命令如下
命令
說(shuō)明
pdbedit -L
列出samba用戶列表
pdbedit -Lv
列出samba用戶詳細(xì)信息
pdbedit -Lw
列出smbpasswd格式的用戶
pdbedit –a wj
增加用戶wj
pdbedit –x wj
刪除用戶wj
pdbedit –c “[D]” –u wj
暫停用戶wj
pdbedit –c “[]” –u wj
回復(fù)用戶wj

3、添加用戶,必須確保這個(gè)用戶存在于你的Linux系統(tǒng)中
[root@localhost wj]# pdbedit -a david    //添加用戶david
new password:
retype new password:
Unix username:        david
NT username:         
Account Flags:        [U          ]
User SID:             S-1-5-21-1098217942-694112815-2930643030-1000
Primary Group SID:    S-1-5-21-1098217942-694112815-2930643030-513
Full Name:            david
Home Directory:       \\localhost\david
HomeDir Drive:        
Logon Script:         
Profile Path:         \\localhost\david\profile
Domain:               LOCALHOST
Account desc:         
Workstations:         
Munged dial:         
Logon time:           0
Logoff time:          never
Kickoff time:         never
Password last set:    三, 15 8月 2018 10:15:21 CST
Password can change:  三, 15 8月 2018 10:15:21 CST
Password must change: never
Last bad password   : 0
Bad password count  : 0
Logon hours         : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
[root@localhost wj]# pdbedit -L    //查看是否添加成功
david:500:david

4、重啟smb服務(wù)
[root@localhost wj]# gedit /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 137 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
[root@localhost wj]# service iptables restart
iptables:將鏈設(shè)置為政策 ACCEPT:filter nat                [確定]
iptables:清除防火墻規(guī)則:                                 [確定]
iptables:正在卸載模塊:                                   [確定]
iptables:應(yīng)用防火墻規(guī)則:                                 [確定]
iptables:載入額外模塊:nf_conntrack_ftp                   [確定]

5、啟動(dòng)smb服務(wù)
[root@localhost wj]# service smb restart
關(guān)閉 SMB 服務(wù):                                            [確定]
啟動(dòng) SMB 服務(wù):                                            [確定]
[root@localhost wj]#

6、從windows測(cè)試,按下快捷鍵“window+r”,在彈出的窗口輸入命令“smb:\\192.168.0.113”,要求輸入用戶名和密碼,匿名用戶也無(wú)法登陸。
      
[color=rgb(68, 68, 6]      
[color=rgb(68, 68, 6]     用戶登錄后,只能查看自己的家目錄,不能選擇其他目錄
[color=rgb(68, 68, 6]      
[color=rgb(68, 68, 6]      




論壇徽章:
1
15-16賽季CBA聯(lián)賽之福建
日期:2018-12-10 14:43:45
29 [報(bào)告]
發(fā)表于 2018-12-17 08:13 |只看該作者
安裝swat
      swat是一個(gè)圖形化的samba管理軟件,可以幫助不熟悉的人去靈活的配置samba服務(wù),
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    //端口號(hào)
    socket_type   = stream
    wait       = no
    only_from = 127.0.0.1    //是否只允許本機(jī)登錄,如果想在其他電腦登錄,那么用#注釋掉這句話。
    user       = root
    server     = /usr/sbin/swat
    log_on_failure    += USERID
    disable       = no   //這里一定要是no,默認(rèn)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:將鏈設(shè)置為政策 ACCEPT:filter nat                [確定]
iptables:清除防火墻規(guī)則:                                 [確定]
iptables:正在卸載模塊:                                   [確定]
iptables:應(yīng)用防火墻規(guī)則:                                 [確定]
iptables:載入額外模塊:nf_conntrack_ftp                   [確定]

4、啟動(dòng)swat服務(wù)
[root@localhost wj]# service xinetd start
正在啟動(dòng)xinetd:   

5、在瀏覽器輸入“ip:901”,可以看到一個(gè)圖形化的管理界面
     

論壇徽章:
1
15-16賽季CBA聯(lián)賽之福建
日期:2018-12-10 14:43:45
30 [報(bào)告]
發(fā)表于 2018-12-18 07:35 |只看該作者
本帖最后由 一生有你llx 于 2018-12-18 07:41 編輯

DansGuardian
       DansGuardian可以限制客戶端的訪問(wèn),通過(guò)這個(gè)軟件,我們可以限制哪些網(wǎng)站不可以訪問(wèn)、哪些內(nèi)容不能下載。
1、下載DansGuardian,提供一個(gè)網(wǎng)址http://www.rpmfind.net/linux/RPM/dag/redhat/el5/i386/dansguardian-2.8.0.6-1.2.el5.rf.i386.html

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。默認(rèn)是8080,和tomcat沖突。關(guān)于proxyport端口,使用的是proxy服務(wù)器端口,默認(rèn)3128,如果你修改了proxy的端口,那么這里也要改成對(duì)應(yīng)的端口。
[root@localhost wj]# gedit /etc/dansguardian/dansguardian.conf
# the port that DansGuardian listens to.
filterport = 8088

4、配置防火墻,打開(kāi)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:將鏈設(shè)置為政策 ACCEPT:filter nat                [確定]
iptables:清除防火墻規(guī)則:                                 [確定]
iptables:正在卸載模塊:                                   [確定]
iptables:應(yīng)用防火墻規(guī)則:                                 [確定]
iptables:載入額外模塊:nf_conntrack_ftp                   [確定]

5、啟動(dòng)服務(wù)
[root@localhost wj]# service dansguardian start
正在關(guān)閉 Web Content Filter (dansguardian):               [確定]
啟動(dòng) Web Content Filter (dansguardian):                   [確定]

6、修改客戶端的代理設(shè)置,將代理端口改成dansguardian的端口8088,然后去百度一些內(nèi)容,不良的網(wǎng)站就被屏蔽了。注意,這里端口必須修改,不可以使用3128.
      
      


7、增加過(guò)濾網(wǎng)址。
1)修改配置文件“/etc/dansguardian/bannedsitelist”,在后面追加要過(guò)濾的網(wǎng)址。重啟服務(wù)
[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
正在關(guān)閉 Web Content Filter (dansguardian):               [確定]
啟動(dòng) Web Content Filter (dansguardian):                   [確定]
2)客戶端訪問(wèn)百度新聞
      

8、過(guò)濾關(guān)鍵字
1)修改配置文件“/etc/dansguardian/bannedphraselist”,在后面追加要過(guò)濾的網(wǎng)址。重啟服務(wù)
[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
正在關(guān)閉 Web Content Filter (dansguardian):               [確定]
啟動(dòng) Web Content Filter (dansguardian):                   [確定]
2)使用客戶端瀏覽器搜索sex,發(fā)現(xiàn)網(wǎng)頁(yè)打不開(kāi)
      
      


9、過(guò)濾下載內(nèi)容
1)修改配置文件“/etc/dansguardian/bannedextentsionlist”,里面默認(rèn)已經(jīng)有很多被禁止下載的格式了,如果要去掉某個(gè)限制,在前面加#
[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
正在關(guān)閉 Web Content Filter (dansguardian):               [確定]
啟動(dòng) Web Content Filter (dansguardian):                   [確定]
2)使用客戶端瀏覽器下載一個(gè)文件
      

10、查看日志?梢酝ㄟ^(guò)日志文件“/var/log/dansguardian/access.log”來(lái)分析當(dāng)前哪些內(nèi)容被攔截了。
[root@localhost wj]# gedit /var/log/dansguardian/access.log
Sella&utm_term=wkjxxx0913 *DENIED* 禁止的文件擴(kuò)展名: .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

您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過(guò)ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP