สิ่งที่ต้องทำมีดังนี้
1. แก้ไขไฟล์ #vim main.cf
เพิ่มบรรทัดด้านล่าง
smtpd_restriction_classes = external, local_only
external = reject_unauth_destination
local_only = check_recipient_access hash:/etc/postfix/local_domains, reject_unauth_destination
smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/restricted_senders
2. สร้างไฟล์ local_domains แล้วแอดโดเมนที่ต้องการให้ส่งเมลออกได้ (ส่วนใหญ่เป็นเมลภายในบริษัท) ดังนี้
#vim local_domains
domain.com OK
abc.domain.org OK
บันทึก แล้ว postmap /etc/postfix/local_domains
3. สร้างไฟล์ #vim restricted_senders
เพิ่มข้อมูลดังนี้
บรรทัดที่ 1: ใส่เมลที่ต้องการให้ส่งเมลออกได้
บรรทัดที่ 2: ใส่โดเมนที่ไม่ต้องการให้ส่งเมลออกไป
#vim restricted_senders
abc@domain.com OK
domain.com local_only
* สำหรับการเพิ่มเมลคนอื่น ๆ ก็ใส่เพิ่มเข้ามาก่อนบรรทัด domain.com local_only
เสร็จแล้วรันคำสั่ง
#postmap /etc/postfix/restricted_sendes
4. ให้ตรวจสอบ file /etc/default/saslauthd
# Example: MECHANISMS="pam"
#MECHANISMS="ldap"
PARAMS="-r"
MECHANISMS="rimap -O 192.168.0.xx" (IP Mail server ตัวหลัก)
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"
5. สุดท้ายสั่ง service postfix ,saslauthd เพื่อใช้งาน
/etc/init.d/postfix restart
/etc/init.d/saslauthd restart
บทความที่เกี่ยวข้อง
Thursday, June 18, 2015
Friday, May 29, 2015
Backup, check space and delete old file backup
1.Backup file
------------------------script backup.sh---------------------------------------------------------
###mount -o username=administrator,password=xxxx //IP address/Path /mnt/backup
LISTS="/home"
BACKUPLAST=2
BACKUP_PATH="/media/Backup"
DAY_DELETE=`date -d "+%Y%m%d"`
DAY_BACKUP=`date "+%Y%m%d"`
DELETE="${BACKUP_PATH}/${DAY_DELETE}.tar.bz2"
BACKUP="${BACKUP_PATH}/${DAY_BACKUP}.tar.bz2"
if [ -s ${DELETE} ]
then
rm -rf ${DELETE}
fi
if [ -s ${BACKUP} ]
then
rm -rf ${BACKUP}
fi
#tar cfvz ${BACKUP} ${LISTS}
tar -jPcf ${BACKUP} ${LISTS}
--------------------------------------------------------------------------------------------------
2. Check space and send mail every day
-------------------------checkspace.sh----------------------------------------------------------
df -H >checkspace.txt
echo "Check disk space complete" | mutt -a "checkspace.txt" -s "Check disk space complete" -- email@domain.com
---------------------------------------------------------------------------------------------------
3. delete old file backp
------------------------script removeoldfilebackup.sh--------------------------------------------
find /media/Backup/ -type f -mtime +7 -name '*.bz2' -execdir rm -- {} +
ls -lt /media/Backup > listbackup.txt
echo "Delete old file backup complete" | mutt -a "listbackup.txt" -s "Delete old file backup complete" -- email@domain.com
-----------------------------------------------------------------------------------------------
------------------------script backup.sh---------------------------------------------------------
###mount -o username=administrator,password=xxxx //IP address/Path /mnt/backup
LISTS="/home"
BACKUPLAST=2
BACKUP_PATH="/media/Backup"
DAY_DELETE=`date -d "+%Y%m%d"`
DAY_BACKUP=`date "+%Y%m%d"`
DELETE="${BACKUP_PATH}/${DAY_DELETE}.tar.bz2"
BACKUP="${BACKUP_PATH}/${DAY_BACKUP}.tar.bz2"
if [ -s ${DELETE} ]
then
rm -rf ${DELETE}
fi
if [ -s ${BACKUP} ]
then
rm -rf ${BACKUP}
fi
#tar cfvz ${BACKUP} ${LISTS}
tar -jPcf ${BACKUP} ${LISTS}
--------------------------------------------------------------------------------------------------
2. Check space and send mail every day
-------------------------checkspace.sh----------------------------------------------------------
df -H >checkspace.txt
echo "Check disk space complete" | mutt -a "checkspace.txt" -s "Check disk space complete" -- email@domain.com
---------------------------------------------------------------------------------------------------
3. delete old file backp
------------------------script removeoldfilebackup.sh--------------------------------------------
find /media/Backup/ -type f -mtime +7 -name '*.bz2' -execdir rm -- {} +
ls -lt /media/Backup > listbackup.txt
echo "Delete old file backup complete" | mutt -a "listbackup.txt" -s "Delete old file backup complete" -- email@domain.com
-----------------------------------------------------------------------------------------------
* find /location/* -type f -mtime +7 -exec rm -rf {} \;
* find /location/findname.log -type f -mtime +7 -exec rm -rf {} \;
4.crontab -l
0 */3 * * * /sbin/service dovecot reload
0 0 * * * /root/./backup.sh
0 4 * * * /root/./checkspace.sh
0 5 * * * /root/./removeoldfilebackup.sh
4.crontab -l
0 */3 * * * /sbin/service dovecot reload
0 0 * * * /root/./backup.sh
0 4 * * * /root/./checkspace.sh
0 5 * * * /root/./removeoldfilebackup.sh
Labels:
check space,
crontab,
delete,
script,
script backup,
script delete
Sunday, May 24, 2015
Reset surface to default
Reference: Microsoft
Reset from the Windows sign-in screen
Reset from the Windows sign-in screen
Notes
- If you’ve lost your password, you may not have to reset your Surface. See I forgot my password before
performing these reset steps. - If you don't have a keyboard connected to your Surface Pro or
Surface 3, you'll need to use the on-screen keyboard to do these reset
steps. From the Windows sign-in screen, tap or click the Ease of access icon
in the lower-left corner of the screen, and then tap or click On-Screen Keyboard.
| Step 1: | From the Windows sign-in screen, tap or click Power |
| Step 2: | Press and hold the Shift key. (If you're using the on-screen keyboard, tap or click the Shift key.) |
| Step 3: | While the Shift key is still pressed, tap or click Restart. If you get the prompt Restart anyway, tap or click Restart anyway. After Surface restarts, the Choose an option screen will appear. |
| Step 4: | Tap or click Troubleshoot. |
| Step 5: | Tap or click Reset your PC. Surface restarts and the Surface logo displays while Windows prepares to reset your Surface. |
| Step 6: | On the Reset your PC screen, tap or click Next. |
| Step 7: | Choose either Just remove my files or Fully clean the drive. The option to clean the drive is more secure, but takes much longer. For example, if you are recycling your Surface, you should choose to clean the drive. If you are keeping your Surface, you just need to remove your files. |
| Step 8: | Tap or click Reset. Surface restarts and the Surface logo displays while the reset process completes (this can take several minutes). |
Saturday, May 23, 2015
create usb boot with dd command
Format disk to fat32 before create usb boot
format fat32 command
sudo mkfs.vfat -I -F32 /dev/sdx
format NTFS
sudo mkfs.ntfs /dev/sdx
format ext4
sudo mkfs.ext4 -L label /dev/sdx
sudo mkfs.ext4 -F -O ^64bit -L 'Label disk' '/dev/sdx1'
#fdisk -l
build usb boot
#
#dd if=ubuntu-mate-14.04.2-LTS-desktop-i386.iso of=/dev/sdc bs=1M
or
dd if=/dev/sdb of=/home/hades/Downloads/OS/hilen-boot.img bs=1M
7633+1 records in
7633+1 records out
8004304896 bytes (8.0 GB) copied, 370.764 s, 21.6 MB/s
#(pv -n lubuntu-15.04-alternate-i386.iso | dd of=/dev/sdb bs=1M) 2>&1 | dialog --gauge "Running dd command (copyfile), please wait..." 10 70
#pv -tpreb lubuntu-15.04-alternate-i386.iso | dd of=/dev/sdb bs=1M
651MB 0:01:30 [7.18MB/s] [=================================================================>] 100%
0+5209 records in
0+5209 records out
682622976 bytes (683 MB) copied, 92.9512 s, 7.3 MB/s
3. sudo dd if=file.iso |pv| sudo dd of=/dev/sdX bs=1M
ถ้าไฟล์เล็กๆเยอะๆ dd จะไวกว่ามาก เพราะมันไม่สนจำนวนไฟล์ มันอ่านข้อมูลเป็น block จาก hdd เลย
ข้อเสียคือมันจะทำทั้งลูก ต่อให้มีข้อมูลอยู่ 1kb มันก็ทำทั้งลูกอยู่ดี
format fat32 command
sudo mkfs.vfat -I -F32 /dev/sdx
format NTFS
sudo mkfs.ntfs /dev/sdx
format ext4
sudo mkfs.ext4 -L label /dev/sdx
sudo mkfs.ext4 -F -O ^64bit -L 'Label disk' '/dev/sdx1'
#fdisk -l
build usb boot
#
#sudo umount /dev/sdc #dd if=ubuntu-mate-14.04.2-LTS-desktop-i386.iso of=/dev/sdc bs=1M
or
#sudo dd if=./ubuntu.iso of=/dev/sdd bs=8129#complete1076+1 records in
1076+1 records out
1128595456 bytes (1.1 GB) copied, 220.276 s, 5.1 MB/sif= source file iso, img of= flash drivebs= Read & Write rate
#clone to image filedd if=/dev/sdb of=/home/hades/Downloads/OS/hilen-boot.img bs=1M
7633+1 records in
7633+1 records out
8004304896 bytes (8.0 GB) copied, 370.764 s, 21.6 MB/s
แบบมี status ว่าทำได้กี่ %1.ต้องติดตั้ง package pv dialog (sudo apt-get install pv dialog)#(pv -n lubuntu-15.04-alternate-i386.iso | dd of=/dev/sdb bs=1M) 2>&1 | dialog --gauge "Running dd command (copyfile), please wait..." 10 70
2. pv -tpreb lubuntu-15.04-alternate-i386.iso | dd of=/dev/sdb bs=1M#pv -tpreb lubuntu-15.04-alternate-i386.iso | dd of=/dev/sdb bs=1M
651MB 0:01:30 [7.18MB/s] [=================================================================>] 100%
0+5209 records in
0+5209 records out
682622976 bytes (683 MB) copied, 92.9512 s, 7.3 MB/s
3. sudo dd if=file.iso |pv| sudo dd of=/dev/sdX bs=1M
* สามารถ Clone disk to disk ได้ด้วย* dd มันอ่านข้อมูลเป็น block แล้วก้อปไปใส่อีกตัวตรงๆถ้าไฟล์เล็กๆเยอะๆ dd จะไวกว่ามาก เพราะมันไม่สนจำนวนไฟล์ มันอ่านข้อมูลเป็น block จาก hdd เลย
ข้อเสียคือมันจะทำทั้งลูก ต่อให้มีข้อมูลอยู่ 1kb มันก็ทำทั้งลูกอยู่ดี
Friday, May 15, 2015
clear save password samba on ubuntu
when you login share file and save permanent password user and then you want to clear user and password
How to do?
#cd /home/user/.gnome2/
#mv keyrings keyrings_mv --> clear user and password
How to do?
#cd /home/user/.gnome2/
#mv keyrings keyrings_mv --> clear user and password
Wednesday, May 13, 2015
reset password root mysql
run command folowing
1. service myql stop
2. mysqld_safe --skip-grant-tables
3.mysql --user=root mysql
4.
update user set Password=PASSWORD('new-password') where user='root';
flush privileges;
exit;
5. service mysql restart6. test login myql -uroot -p7. test login on phpmyadmin
1. service myql stop
2. mysqld_safe --skip-grant-tables
3.mysql --user=root mysql
4.
update user set Password=PASSWORD('new-password') where user='root';
flush privileges;
exit;
5. service mysql restart6. test login myql -uroot -p7. test login on phpmyadmin
----------------------------------------------------------------
How to reset the root password for mysql:
Stop mysql:
1. service mysql stop
Run mysql with skip grants to be able to login without any password
2. mysqld_safe --skip-grant-tables &
Login as root
3. mysql -u root
4. mysql commands:
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD-HERE") where User='root';
mysql> flush privileges;
mysql> quit
Stop mysql
5. service mysql stop
Start mysql normally:
6. service mysql start
Try to login using your new password:
7. mysql -u root -p
How to reset the root password for mysql:
Stop mysql:
1. service mysql stop
Run mysql with skip grants to be able to login without any password
2. mysqld_safe --skip-grant-tables &
Login as root
3. mysql -u root
4. mysql commands:
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD-HERE") where User='root';
mysql> flush privileges;
mysql> quit
Stop mysql
5. service mysql stop
Start mysql normally:
6. service mysql start
Try to login using your new password:
7. mysql -u root -p
Reference site
Sunday, May 10, 2015
remmina Protocol plugin RDP is not installed (Kali)
1. after insall remmina
1.1 don't forget install remmina-plugin-rdp
2. just install package libfreerdp1_1.0.1-1.1+deb7u3_amd64.deb3
3. see picture click amd64
4. shoose Asia see picture
5. install package : sudo dpkg -i libfreerdp1_1.0.1-1.1+deb7u3_amd64.deb
1.1 don't forget install remmina-plugin-rdp
2. just install package libfreerdp1_1.0.1-1.1+deb7u3_amd64.deb3
3. see picture click amd64
4. shoose Asia see picture
5. install package : sudo dpkg -i libfreerdp1_1.0.1-1.1+deb7u3_amd64.deb
Install line on kali, ubuntu
how to install line on ubunt
1. Install wine
#apt-get install wine
2. Downlaod line
gotot website: db.tt/G5doCA01
save file LINE.zip
unzip file LINE.zip and copy folder LINE to /home/youehome/.wine/drive_c/Program Files/
3. Edit line script
#cd /usr/bin
#mv line line_mv
#vim line
-------------------------------------------Create new script ---------------------------------------------
#!/bin/bash
wine /home/yourhome/.wine/drive_c/Program\ Files/LINE/Line.exe 2>&1
/dev/null
------------------------------------------Save and exit --------------------------------------------------
Change permission
#chomod u+x line
#chmod o+x line
4. Create short cut to desktop (see picture)
for create short cut ubuntu 15.04 read here!
* Icone line
3. add font thai
4. add font thai 2
copy font thai to drive /home/my user/.wine/drive_c/windows/
sed -i "s/font-family:[^;]*;/font-family:'tahoma';/g" ~/.wine/drive_c/Program\ Files/LINE/res/skin/basic/css/*
1. Install wine
#apt-get install wine
2. Downlaod line
gotot website: db.tt/G5doCA01
save file LINE.zip
unzip file LINE.zip and copy folder LINE to /home/youehome/.wine/drive_c/Program Files/
3. Edit line script
#cd /usr/bin
#mv line line_mv
#vim line
-------------------------------------------Create new script ---------------------------------------------
#!/bin/bash
wine /home/yourhome/.wine/drive_c/Program\ Files/LINE/Line.exe 2>&1
/dev/null
------------------------------------------Save and exit --------------------------------------------------
Change permission
#chomod u+x line
#chmod o+x line
4. Create short cut to desktop (see picture)
for create short cut ubuntu 15.04 read here!
* Icone line
3. add font thai
4. add font thai 2
copy font thai to drive /home/my user/.wine/drive_c/windows/
sed -i "s/font-family:[^;]*;/font-family:'tahoma';/g" ~/.wine/drive_c/Program\ Files/LINE/res/skin/basic/css/*
Sunday, May 3, 2015
Wednesday, April 1, 2015
check disk Wmware
Check
on VMWare
1.
Command #esxcli storage core device list ตรวจสอบ
Hard disk ในเครื่อง
t10.ATA_____ST31500341AS________________________________________9VS2TVTN
Display
Name: Local ATA Disk
(t10.ATA_____ST31500341AS________________________________________9VS2TVTN)
Has
Settable Display Name: true
Size:
1430799
Device
Type: Direct-Access
Multipath
Plugin: NMP
Devfs
Path:
/vmfs/devices/disks/t10.ATA_____ST31500341AS________________________________________9VS2TVTN
Vendor:
ATA
Model:
ST31500341AS
Revision:
CC1H
SCSI
Level: 5
Is
Pseudo: false
Status:
on
Is
RDM Capable: false
Is
Local: true
Is
Removable: false
Is
SSD: false
Is
Offline: false
Is
Perennially Reserved: false
Queue
Full Sample Size: 0
Queue
Full Threshold: 0
Thin
Provisioning Status: unknown
Attached
Filters:
VAAI
Status: unknown
Other
UIDs:
vml.0100000000202020202020202020202020395653325456544e535433313530
Is
Local SAS Device: false
Is
Boot USB Device: false
2. Command #esxcli
storage core device smart get -d
t10.ATA_____ST31500341AS________________________________________9VS2TVTN
Parameter
Value Threshold Worst
----------------------------
----- --------- -----
Health Status
OK N/A N/A
Media Wearout
Indicator N/A N/A N/A
Write Error Count
N/A N/A N/A
Read Error Count
104 6 99
Power-on Hours
59 0 59
Power Cycle Count
100 20 100
Reallocated Sector
Count 100 36 100
Raw Read Error Rate
104 6 99
Drive Temperature
39 0 59
Driver Rated Max
Temperature 61 45 41
Write Sectors TOT
Count 200 0 200
Read Sectors TOT
Count N/A N/A N/A
Initial Bad Block
Count 100 99 100
3. Check all disk with command: /usr/lib/vmware/vm-support/bin/smartinfo.sh
#/usr/lib/vmware/vm-support/bin/smartinfo.sh
SMART Information for disks.
Device: t10.ATA_____KINGSTON_SV300S37A60G___________________50026B774507282B____
Errors:
Error getting Smart Parameters: CANNOT open device
Device: t10.ATA_____ST31500341AS________________________________________9VS3YGKG
Errors:
Error getting Smart Parameters: CANNOT open device
Device: t10.ATA_____WDC_WD20EARX2D00PASB0_________________________WD2DWCAZAD763430
Parameter Value Threshold Worst
-----------------------------------------------------
Health Status OK N/A N/A
Media Wearout Indicator N/A N/A N/A
Write Error Count N/A N/A N/A
Read Error Count 200 51 200
Power-on Hours 64 0 64
Power Cycle Count 100 0 100
Reallocated Sector Count 200 140 200
Raw Read Error Rate 200 51 200
Drive Temperature 110 0 90
Driver Rated Max Temperature N/A N/A N/A
Write Sectors TOT Count 200 0 200
Read Sectors TOT Count 200 0 200
Initial Bad Block Count N/A N/A N/A
Subscribe to:
Posts (Atom)




