Archive for the ‘Linux’ Category

0232 | ติดตั้ง openvpn-otp plugin

Thursday, May 17th, 2018 Posted in IP Network, Linux | No Comments »

copy paste =>

yum -y install epel-
yum -y install openvpn openvpn-devel git autoconf automake libtool openssl-devel libtool-ltdl-devel gcc-c++ make  
cd /usr/local/src  
git clone https://github.com/evgeny-gridasov/openvpn-otp
cd openvpn-otp
./autogen.sh
./configure --with-openvpn-plugin-dir=/usr/lib64/openvpn/plugins
make
make install

แล้วไป config openvpn ต่อได้เลยจ้า https://github.com/evgeny-gridasov/openvpn-otp

คร่าวๆ ฝั่ง server เพิ่มบรรทัดนี้

plugin "/usr/lib64/openvpn/plugins/openvpn-otp.so" "otp_secrets=/etc/openvpn/customroute-otp-secrets password_is_cr=1"

ส่วนฝั่ง client เพิ่มบรรทัดนี้

auth-user-pass
auth-nocache
static-challenge "Enter Google Authenticator Token" 1

(จริงๆ ควรจะมี auth-user-pass อยู่แล้ว)

Tags: , ,

0231 | วิธีลบไฟล์ใน folder ใหญ่ๆ

Monday, January 15th, 2018 Posted in Linux | No Comments »

จดไว้กันลืม + กันหาไม่เจอ 5555+

เอามาจากนี่ครับ https://unix.stackexchange.com/questions/37329/efficiently-delete-large-directory-containing-thousands-of-files

ใช้ได้สามสี่วิธี อันนี้เร็วสุด

cd yourdirectory
perl -e 'for(<*>){((stat)[9]<(unlink))}'

อันนี้รองลงมา

mkdir empty_dir
rsync -a --delete empty_dir/    yourdirectory/

หรือถ้าต้องมีเงื่อนไขอะไรก็

find yourdirectory/ <ใส่เงื่อนไข> -delete