2022年2月24日 星期四

bash GUI 相關資源

TEXT 模式
dialog, whiptail

X Window 模式
zenity, xdialog

xrdp 停用 thinclient_drives

編輯 /etc/xrdp/xrdp.ini
allow_channels=false

注意資源轉向功能全部失效

Debian X session 啟動設定及腳本目錄

/etc/X11/Xsession.options 
/etc/X11/Xsession.d/
/etc/xdg/autostart

The Debian reference manual describes how the defaults work:
If the user has a ~/.xsessionrc file, read it.
If a specific session was selected in the DM (GDM, KDM, WDM, LightDM, ...) , run it.
Otherwise, if the user has a ~/.xsession or ~/.Xsession file, run it.
Otherwise, if the /usr/bin/x-session-manager command exists, run it.
Otherwise, if the /usr/bin/x-window-manager command exists, run it.
Otherwise, if the /usr/bin/x-terminal-emulator command exists, run it.

2022年2月22日 星期二

GO GO111MODULE 與 GOPATH

GO111MODULE=off,使用 GOPATH mode 模式

GO111MODULE=on,使用 Go modules 模式

2022年2月14日 星期一

Windows 10 限制 RDP 資源

執行 gpedit

電腦設定\原則\系統管理範本\Windows元件\遠端桌面服務\遠端桌面工作階段主機\裝置及資源重新導向\

2022年2月10日 星期四

設定 Raspberry pi zero Wifi AP

#安裝相關軟體
apt install -y iptables dnsmasq hostapd

export uap0=192.168.2.1/24
export dhcpr=192.168.2.2,192.168.88.50,12h

#設定網路界面
cat >/etc/network/interfaces.d/wlan0 <<EOF
auto wlan0
allow-hotplug wlan0

iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
EOF

cat >/etc/network/interfaces.d/uap0 <<EOF
iface uap0 inet static
  address 192.168.2.1
  netmask 255.255.255.0
  network 192.168.2.0
  broadcast 192.168.2.255
  gateway 192.168.2.1
EOF

#設定 dhcpd uap0 界面
echo >>dhcpcd.conf <<EOF
interface uap0
static ip_address=${uap0}
nohook wpa_supplicant
EOF

#設定 dnsmasq 服務
cat >>/etc/dnsmasq.conf <<EOF
interface=uap0
no-dhcp-interface=lo,wlan0
bind-interfaces
server=8.8.8.8
domain-needed
bogus-priv
dhcp-range=${dhcpr}
EOF

#設定 hostapd 服務
cat >/etc/hostapd/hostapd.conf <<EOF
interface=uap0
ssid=piap
hw_mode=g
channel=11
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
EOF

echo 'DAEMON_CONF="/etc/hostapd/hostapd.conf"'  >>/etc/default/hostapd
systemctl unmask hostapd

#產生執行 script
cat >/root/startap.sh <<EOF
#!/bin/bash
# Create the virtual device
/sbin/iw dev wlan0 interface add uap0 type __ap
ifup uap0

# Route all the packets coming on this interface, this will enable #us to access internet through wlan0

sysctl net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -s 192.168.2.0/24 ! -d 192.168.2.0/24 -j MASQUERADE

systemctl start dnsmasq
systemctl start hostapd
EOF

Cannot copy/paste text in xfce4-terminal

apt-get install xfce4-clipman xfce4-goodies

編輯 /etc/locale.gen 增加
zh_TW.UTF-8 UTF-8

執行locale-gen

echo LANG=zh_TW.UTF-8  >>/etc/locale.conf

2022年2月8日 星期二

neighbor table overflow

增加數值
/proc/sys/net/ipv4/neigh/default/gc_thresh1
/proc/sys/net/ipv4/neigh/default/gc_thresh2
/proc/sys/net/ipv4/neigh/default/gc_thresh3

echo "net.ipv4.neigh.default.gc_thresh1 = 512" >> /etc/sysctl.conf
echo "net.ipv4.neigh.default.gc_thresh2 = 2048" >> /etc/sysctl.conf
echo "net.ipv4.neigh.default.gc_thresh3 = 4096" >> /etc/sysctl.conf
sysctl -p