2014年5月28日 星期三

how to mount disk that larger than 2TB

1. install the tool like gpart
# apt-get install gpart

2. confirm the disk lable you want to format
# fidsk /dev/sdx

3. use gpart tool to make a partition
#gpart /dev/sdx

make a partition label for it, we use gpt that support larger disk size
(parted) mklabel gpt

Warning: The existing disk label on /dev/sdx will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
set the unit
(parted) unit TB

create 3TB size
(parted) mkpart primary 0.00TB 3.00TB

(parted) quit

4. format the disk
#mkfs.ext4 /dev/sdx

5. mount it
#mkdir /mnt/backup
#mount /dev/sdx1 /mnt/backup

6. use df to confirm the disk size
#df -h

2014年5月27日 星期二

use ldapsearch to query windows active directory

1. install ladp component
#apt-get install ldap-utils

2. -H ldap server
    -b bind
   -D domain account
  -w  doamin password
 
#ldapsearch -LLL -H ldap://dc01.csp.com: 389 -b "dc=csp,dc=com" -D "cps\tommy" -w "abc123" "(sAMAccountName=tommy.lbs)"

2014年5月5日 星期一

install postfix and dovecot and redirect all mail to one account

1. install postfix, pcre and dovecot
# apt-get install postfix postfix-pcre
# apt-get install dovecot-core dovecot-imapd

2. confirm your dns mx record have one mx record for your mail server

3. modify your postfix configuration  for your environment
# vim /etc/postfix/main.cf

myhostname = mail.csp.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, $mydomain, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 172.16.0.0/16
always_bcc = tommy@csp.com.tw
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
home_mailbox = Maildir/

#head_checks
header_checks = pcre:/etc/postfix/header_checks

4.add new file /etc/postfix/header_checks
# vim /etc/postfix/header_checks
/TO:*@*/ REDIRECT check01@csp.com

5. check postfix setting and restart postfix
# postfix check
# /etc/init.d/postfix restart

6.modify /etc/dovecot/dovecot.conf
#vim /etc/dovecot/dovecot.conf
uncomment the lines

listen = *, ::
base_dir = /var/run/dovecot/
instance_name = dovecot
login_greeting = Dovecot ready.

7. change 10-auth.conf
#vim /etc/dovecot/conf.d/10-auth.conf
uncomment line and change the value
disable_plaintext_auth = no

8.change 10-master.conf
#vim /etc/dovecot/conf.d/10-master.conf
change contents within lines as below

service imap-login {
  inet_listener imap {
    port = 143
  }
  inet_listener imaps {
    port = 993
    ssl = yes
  }
service lmtp {
  unix_listener lmtp {
    mode = 0666
  }

service auth {
   # Postfix smtp-auth
  unix_listener /var/spool/postfix/private/auth {
    mode = 0666
    user = postfix
    group = postfix
  }
}
auth_mechanisms = plain login

9. change 10-mail.conf
#vim /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:~/Maildir

10.change 20-imap.conf
#vim /etc/dovecot/conf.d/20-imap.conf
  imap_max_line_length = 64k
  mail_max_userip_connections = 10
  mail_plugins = $mail_plugins
  imap_logout_format = bytes=%i/%o
  imap_client_workarounds = tb-extra-mailbox-sep

11. restart the dovecot services.
# /etc/init.d/dovecot restart