2020年12月30日 星期三

Debian 10 安裝 dante-server

1. apt-get install dante-server

2.編輯 /etc/danted.conf
mv /etc/danted.conf  /etc/danted.conf.ori
cat >/etc/danted.con <<EOF
# /etc/danted.conf

logoutput: syslog
user.privileged: root
user.unprivileged: nobody

# The listening network interface or address.
internal: 0.0.0.0 port=1080

# The proxying network interface or address.
external: eth0

# socks-rules determine what is proxied through the external interface.
# The default of "none" permits anonymous access.
#socksmethod: username
socksmethod:  none

# client-rules determine who can connect to the internal interface.
# The default of "none" permits anonymous access.
clientmethod: none

client pass {
        from: 0.0.0.0/0 to: 0.0.0.0/0
        log: connect disconnect error
}

socks pass {
        from: 0.0.0.0/0 to: 0.0.0.0/0
        log: connect disconnect error
}
EOF                        

3.systemctl enable danted;systemctl start danted

4.測試
 curl -v -x socks5://192.168.1.1:1080 http://www.google.com/



2020年12月16日 星期三

Debian 10 xfce4 更改 wallpaper 筆記

xfconf-query --channel xfce4-desktop --property  /backdrop/screen0/monitorDisplayPort-1/workspace0/last-image --set  /home/1.jpg

相關指令及檔案
xfconf-query --channel xfce4-desktop --list
/usr/share/desktop-base/profiles/xdg-config/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml
~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml

Debian 10 Python 安裝 虛擬環境

apt-get install -y python-libvirt
apt-get install -y libvirt-dev
apt install -y python3-pip
pip3 install virtualenv

2020年12月15日 星期二

Proxmox 6.x LXC 設定quota 摘要

1.host lxc
apt install -y quota

2.lxc
resource configure enable quota
quotacheck -cmug /
quotaon /

2020年12月11日 星期五

bash 尋找可用的port

 #!sh

j=10240

f(){ for i in $(netstat -an|grep TCP|awk '{print $2 }'|uniq|awk -F : '{print $2 }'|sort -n);do [ $1 -lt $i ]&&break;[ $1 -eq $i ]&&echo found&&break; done; };
p(){ for i in $(seq $1 65535);do [ -z "$(f $i)" ]&& echo $i && return 0;done;echo 0;return 1; };
ncvzn(){ r=$(echo|timeout ${3:-3} nc $1 $2 2>/dev/null);r0=$?;echo $r;return $r0;};

for i in p1 p2;do eval "$i=\$(p \$j);j=\$(expr \$$i + 1)";done;
echo $p1 $p2

2020年12月3日 星期四

pvcreate 錯誤訊息:Device /dev/sdx excluded by a filter.

原因為pvcreate 無法識別硬碟分割區訊息

pvcreate /dev/sdx
Device /dev/sdx excluded by a filter.

parted /dev/sdx
mklabel msdos

Proxmox VE 6.x 安裝 Proxmox backup server

 echo "deb http://download.proxmox.com/debian/pbs buster pbs-no-subscription" >/etc/apt/sources.list.d/pbs-no-subscription.list
apt update
apt-get install proxmox-backup-server

Debian 10 瘦身摘要

清除 dpkg cache 相關檔案
/var/lib/apt/lists/
apt clean
apt autoremove --purge

保留所需的 kernel 及module

消除沒用的設定檔
dpkg -l | grep ^rc | cut -d' ' -f3 | sudo xargs dpkg --purge

移除相關多國語言支援
/usr/lib/locale/
/usr/share/locale
apt-get install localepurge
dpkg --configure localepurge
localepurge

參考資料
https://wiki.debian.org/ReduceDebian

2020年12月2日 星期三

Debian 10 安裝 tftp server

apt-get install -y tftpd xinetd

cat <<REM > /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
REM

systemctl enable xinetd
systemctl restart xinetd