2017年7月24日 星期一

linux

#pa aux|grep yum
#kill -9 3829
#yum 


Enable userdir, users can create websites with this setting.
[1]Configure httpd.
[root@www ~]# 
vi /etc/httpd/conf.d/userdir.conf
# line 17: comment out


#
UserDir disabled
# line 24: uncomment

UserDir public_html
# line 31 - 35

<Directory "/home/*/public_html">
    AllowOverride 

All

# change

    Options 

None

# change

    Require method GET POST OPTIONS
</Directory>
[root@www ~]# 
systemctl restart httpd 

[cent@www ~]$ 
mkdir public_html 

[cent@www ~]$ 
chmod 711 /home/cent 

[cent@www ~]$ 
chmod 755 /home/cent/public_html 

[cent@www ~]$
vi ./public_html/index.html
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
UserDir Test Page
</div>
</body>
</html>
要關selinux
 
0727
 
1.nano /etc/httpd/conf/httpd.conf
 
Find the section that begins with <Directory "/var/www/html">. Change the line from AllowOverride none to AllowOverride AuthConfig
AllowOverride AuthConfig Save and close the file.
 2.

Create a password file with htpasswd

 

htpasswd -c /var/www/html/.htpasswd user1
htpasswd  /var/www/html/.htpasswd user2// next user don't -c
[root@localhost ~]# htpasswd -c  /var/www/html/.htpasswd hope
New password: 
Re-type new password: 
Adding password for user hope
 
3.  nano /var/www/html/.htaccess
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /var/www/html/.htpasswd
Require valid-user
4.chown apache:apache /var/www/html/.htaccess
 chown apache:apache /var/www/html/.htpasswd
chmod 0660 /var/www/html/.htpasswd
5.systemctl restart httpd
6.test

====================
8/9
DNS
1.yum install bind bind-chroot bind-utils
2.nano /etc/named.rfc1912.zones
add zone
 zone "ccna16.edu" IN {
        type master;
        file "named.ccna16";
        allow-update { none; };
};

zone "40.168.192.in-addr.arpa" IN {
        type master;
        file "named.reverse";
        allow-update { none; };
};
3. nano /var/named/named.reverse
$TTL 1D
@ IN SOA @ ccna16.edu. (100 1H 2D 3W 1H)
@ IN NS ccna16.edu.
253     IN PTR ccna16.edu.
253     IN PTR www.ccna16.edu.
 nano /var/named/named.ccna16 
 $TTL 1D
@ IN SOA @ rname.invalid. (
                                       0
                                        1D
                                        1H
                                        1W
                                        3H )

                NS @
                A 192.168.40.253
www             A 192.168.40.253
 4.systemctl restart named
5.[root@localhost ~]# dig -x 192.168.40.253 @localhost

; <<>> DiG 9.9.4-RedHat-9.9.4-50.el7_3.1 <<>> -x 192.168.40.253 @localhost
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26026
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;253.40.168.192.in-addr.arpa. IN PTR

;; ANSWER SECTION:
253.40.168.192.in-addr.arpa. 86400 IN PTR ccna16.edu.
253.40.168.192.in-addr.arpa. 86400 IN PTR www.ccna16.edu.

;; AUTHORITY SECTION:
40.168.192.in-addr.arpa. 86400 IN NS ccna16.edu.

;; ADDITIONAL SECTION:
ccna16.edu.  86400 IN A 192.168.40.253

;; Query time: 1 msec
;; SERVER: ::1#53(::1)
;; WHEN: 三  8月 09 15:34:44 CST 2017
;; MSG SIZE  rcvd: 128
=================
8/10
postfix
1.預備動作
nano /var/named/named.ccna16
加入 
mail    A  192.168.40.253
ccna16.edu  MX 10 mail.ccna16.edu.

重啟 named
systemctl restart named

測試
Microsoft Windows [版本 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Administrator>nslookup
預設伺服器:  dns.hinet.net
Address:  168.95.1.1

> server 192.168.40.253
預設伺服器:  [192.168.40.253]
Address:  192.168.40.253

> set type=mx
> ccna16.edu
伺服器:  [192.168.40.253]
Address:  192.168.40.253

ccna16.edu      MX preference = 10, mail exchanger = mail.ccna16.edu
ccna16.edu      nameserver = ccna16.edu
mail.ccna16.edu internet address = 192.168.40.253
ccna16.edu      internet address = 192.168.40.253
2.firewall-cmd --permanent --add-service=smtp
firewall-cmd --permanent --add-port=110/tcp
firewall-cmd --permanent --add-port=143/tcp
firewall-cmd --reload

systemctl start postfix
systemctl enable postfix

3.#vim /etc/postfix/main.cf
myhostname = mail.ccna16.edu
mydomain = ccna16.edu
myorigin = $mydomain
mynetworks_style = class
mynetworks = 127.0.0.0/8, 192.168.40.0/24

inet_interfaces = all
mydestination = $mydomain, $myhostname, localhost.$mydomain, localhost
mail_spool_directory = /var/mail

home_mailbox = Maildir/
mailbox_size_limit = 0  #原設定參數沒有
message_size_limit = 0  #請自己加上即可
4.編修設定檔 /etc/dovecot/dovecot.conf
protocols = imap pop
5.編修設定檔 /etc/dovecot/conf.d/10-mail.conf:
打開mail_location = mbox:~/mail:INBOX=/var/mail/%u
6.
[hope@localhost ~]$ nano ~/.muttrc
#su - student
$vim ~/.muttrc
set mbox_type=Maildir
set folder="~/Maildir"
set mask="!^\\.[^.]"
set mbox="~/Maildir"
set record="+.Sent"
set postponed="+.Drafts"
set spoolfile="~/Maildir"
 
8/30 practice network command and manage
1.ip address show
  ip -s link show enp0s3
  ip address add 10.0.0.2/24 brd + dev enp0s3
 ip address del 10.0.0.2/24 dev enp0s3
2.systemctl start NetworkManager
            stop stop restart enable disable 
  cancle MN instead network
 chkconfig network on
cat /etc/sysconfig/network-scripts/ifcfg-enp0s3  //the configuration place 
ifdown enp0s3
ifconfig
ifup enp0s3
3.test tool
netstat -ntulp
n with port
t tcp
u udp
l listen
p pid
   
 
 
 

沒有留言:

張貼留言