Install DenyHosts on Linux VPS

#!/bin/bash
PKG_VER=2.10
PKG_DIR=denyhosts-${PKG_VER}
PKG_TAR=${PKG_DIR}.tar.gz
PKG_URL=https://sourceforge.net/projects/denyhosts/files/denyhosts/${PKG_VER}

rm ${PKG_TAR}
rm -rf ${PKG_DIR}
wget –no-check-certificate  ${PKG_URL}/${PKG_TAR}
tar xvfz ${PKG_TAR}

sudo mv ${PKG_DIR}/ /usr/share/denyhosts

cd /usr/share/denyhosts/
sudo cp denyhosts.conf /etc

CFG=/etc/denyhosts.conf
sudo sed -i “s/DENY_THRESHOLD_ROOT = 1/DENY_THRESHOLD_ROOT = 8/” ${CFG}
sudo sed -i “s/ADMIN_EMAIL = root@localhost/ADMIN_EMAIL = /” ${CFG}

sudo cp denyhosts.py /usr/sbin/denyhosts
sudo mv daemon-control-dist daemon-control

cd /etc/init.d
sudo ln -s /usr/share/denyhosts/daemon-control denyhosts
sudo touch /var/log/auth.log
sudo update-rc.d denyhosts start
sudo /etc/init.d/denyhosts start

 

 

TOSHIBA P300 failing in 5 month

It is reported that one harddisk is failling during boot time of PC,

Error log:

SMART overall-health self-assessment test result: FAILED!
Drive failure expected in less than 24 hours. SAVE ALL DATA.
Failed Attributes:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  5 Reallocated_Sector_Ct   0x0033   002   002   005    Pre-fail  Always   FAILING_NOW 1933

 

Disk Model:    TOSHIBA P300 

Supplier:         JD.com

Purchased Date:    2021/05

Report Date:           2021/10

Usage:   SWAP

 

How to check disk status:

smartctl -H /dev/sda

How to make disk test:

smartctl -t long /dev/sda

How to get disk test report:

smartctl -l error /dev/sda

Debian Wheezy: Audio with 2nd Sound Card

# Check sound card
aplay -l

  • # Config 2nd sound card for aplay, add .asoundrc file under home directory
    nano ~/.asoundrc
    defaults.pcm.card 1
    defaults.pcm.device 0
    defaults.ctl.card 1
  • defaults.timer.card 1

# Config 2nd sound card for mpd, update /etc/mpd.conf
nano /etc/mpd.conf
audio_output {
type “alsa”
name “My ALSA Device”
— device “hw:0,0” # optional
++ device “hw:1,0”
format “44100:16:2” # optional
mixer_device “default”
mixer_control “PCM”
mixer_index “0”
}

Debian Wheezy: Setup RTL8192 USB wifi adaptor

apt-get clear

apt-get update

apt-get install wireless-tools

apt-get install wpasupplicant

lsusb|grep -i wlan

apt-cache search -i RTL8188CU

apt-get install firmware-realtek

dmesg|grep -i rtl

iwlist scanning

iwlist wlan0 scan|more

nano /etc/network/interface

auto wlan0
iface wlan0 inet dhcp
        wpa-ssid               ‘my ssid’
        wpa-key-mgmt     WPA_PSK
        wpa-group            TKIP CCMP
        wpa-psk               ‘my password’

/etc/init.d/networking restart

ifconfig wlan0

Debian Wheezy: server setup/configuration

# Change default Language:
dpkg-reconfigure locales

# Change font size of tty:
setfont /usr/share/consolefonts/Lat15-Terminus24x12.psf.gz

# Change default font size for all tty:
nano /etc/default/console-setup
–FONTFACE=”Fixed”
–FONTSIZE=”8×16″
++FONTFACE=”LAT15-Terminus”
++FONTSIZE=”24×12″

/etc/init.d/console-setup restart

# Update /etc/apt/source.list

# wheezy
deb http://debian.ustc.edu.cn/debian/ wheezy main
deb-src http://debian.ustc.edu.cn/debian/ wheezy main

deb http://debian.ustc.edu.cn/debian/ wheezy non-free
deb-src http://debian.ustc.edu.cn/debian/ wheezy non-free

deb http://debian.ustc.edu.cn/debian/ wheezy contrib
deb-src http://debian.ustc.edu.cn/debian/ wheezy contrib

# security
deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main

# updates
deb http://debian.ustc.edu.cn/debian/ wheezy-updates main
deb-src http://debian.ustc.edu.cn/debian/ wheezy-updates main

deb http://debian.ustc.edu.cn/debian/ wheezy-updates non-free
deb-src http://debian.ustc.edu.cn/debian/ wheezy-updates non-free

deb http://debian.ustc.edu.cn/debian/ wheezy-updates contrib
deb-src http://debian.ustc.edu.cn/debian/ wheezy-updates contrib

# proposed updates
deb http://debian.ustc.edu.cn/debian/ wheezy-proposed-updates main
deb-src http://debian.ustc.edu.cn/debian/ wheezy-proposed-updates main

deb http://debian.ustc.edu.cn/debian/ wheezy-proposed-updates non-free
deb-src http://debian.ustc.edu.cn/debian/ wheezy-proposed-updates non-free

deb http://debian.ustc.edu.cn/debian/ wheezy-proposed-updates contrib
deb-src http://debian.ustc.edu.cn/debian/ wheezy-proposed-updates contrib

# backports
deb http://debian.ustc.edu.cn/debian/ wheezy-backports main
deb-src http://debian.ustc.edu.cn/debian/ wheezy-backports main

deb http://debian.ustc.edu.cn/debian/ wheezy-backports non-free
deb-src http://debian.ustc.edu.cn/debian/ wheezy-backports non-free

deb http://debian.ustc.edu.cn/debian/ wheezy-backports contrib
deb-src http://debian.ustc.edu.cn/debian/ wheezy-backports contrib

 

# Install mouse daemon

apt-get install gpm