-
Notifications
You must be signed in to change notification settings - Fork 33
/
person_settings.sh
executable file
·159 lines (132 loc) · 16.3 KB
/
person_settings.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/bin/bash
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
set_sshd() {
mkdir -p /root/.ssh
chmod 700 /root/.ssh
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDuwLr5N5CxF51tEOXtJJ3Qr2+uY7lVtZfWNwN59yewWUhc6p77CiWj917TrOgrgGMIIgb7AXU0vrdNr2IFJ0fNdyF9S9dfEU8+KAqr+FUH7ywQ8b2sktbqTyVLEZ/lVcd7/+KPxFIP7L7UILqEIIx0rGPVAax8UEwLtMlJ1fakPL98UMTx94hQ2ZW8LW6MJsKd2RWoMkbsn0Joif3SiUGCeGcY8IDzQC8xUZQPFJxVkHqj5Z4iDqms8TNNaKYp7nirTTGHiFW0x7uSAoBxXqKur+c0JLc3ABi5FIlC3+yVtwVr7l4/eHK7bRb/iERoMNEyVF22U5Sha41NQZquDitF root@localhost' >>/root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
sed -i '/ChallengeResponseAuthentication /c ChallengeResponseAuthentication no' /etc/ssh/sshd_config
sed -i '/PasswordAuthentication /c PasswordAuthentication no' /etc/ssh/sshd_config
sed -i '/Port /c Port 22' /etc/ssh/sshd_config
sed -i '/HashKnownHosts /c HashKnownHosts no' /etc/ssh/ssh_config
service sshd restart
}
set_bash() {
cd /root
cat >>.bashrc <<EOF
# prompt string
export PS1="\n\[\e[47;30m\]\u@\h\[\e[m\] \\\$PWD\n\\\\$ "
# color variable
export LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:"
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# command highlight
alias ls="ls --color=auto"
alias grep="grep --color=auto"
# record command execution time
export HISTTIMEFORMAT='%F %T '
# real-time recording
shopt -s histappend
export PROMPT_COMMAND='history -a'
# search history commands beginning with this string of characters
if [ -t 1 ]; then
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
fi
# cd ignore file
complete -d cd
# remove windows path
export PATH=$(echo -n "$PATH" | tr ':' '\n' | grep -Ev '^/mnt' | tr '\n' ':' | sed 's|:$||')
# bash completion
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
# clean console information
clear
EOF
sed -i '/HISTSIZE/d' .bashrc
sed -i '/HISTFILESIZE/d' .bashrc
cat >>.bashrc <<EOF
# change .bash_history record number(default: 500)
export HISTSIZE=500000
export HISTFILESIZE=500000
EOF
if uname -r | grep -q 'WSL'; then
echo '
# set proxy
gateway_ip=$(ip route | grep -Eo -m1 "([0-9]{1,3}\.){3}[0-9]{1,3}")
export http_proxy=http://$gateway_ip:10809
export https_proxy=http://$gateway_ip:10809
if [ -f "/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe" ]; then
windows_no_proxy=$(/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe "Get-NetIPAddress -AddressFamily IPv4 | Select-Object -ExpandProperty IPAddress" | tr -d "\r" | tr "\n" "," | sed "s|,$||g")
export no_proxy=localhost,$windows_no_proxy
else
export no_proxy=localhost,127.0.0.1
fi
git config --replace-all --global http.proxy http://$gateway_ip:10809
git config --replace-all --global https.proxy http://$gateway_ip:10809
' >>.bashrc
(
crontab -l
echo '*/5 * * * * hwclock -s'
) | crontab -
fi
chmod 644 .bashrc
}
set_timezone_and_language() {
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo "Asia/Shanghai" >/etc/timezone
echo "LANG=C.UTF-8" >/etc/default/locale
}
set_grub2() {
# remove wait time
sed -i "/GRUB_TIMEOUT=/c GRUB_TIMEOUT=0" /etc/default/grub
update-grub2
}
set_console_input() {
cat >>/root/.inputrc <<EOF
set completion-ignore-case on
set enable-bracketed-paste off
EOF
}
install_person_bin() {
mkdir -p /usr/xbin
echo -n 'IyEvYmluL2Jhc2gKCmZvciBmaWxlIGluICQobHMgL3Vzci94YmluKTtkbwoJZWNobyAiICAgIGVjaG8gLW4gJyQoY2F0IC91c3IveGJpbi8kZmlsZSB8IGJhc2U2NCB8IHRyIC1kICdcbicpJyB8IGJhc2U2NCAtZCA+L3Vzci94YmluLyRmaWxlIgpkb25lCg==' | base64 -d >/usr/xbin/bak_xbin
echo -n 'IyEvYmluL2Jhc2gKCm5ldHN0YXQgLXR1bnBsIHwgc2VkICIxLDJkIiB8IGF3ayAnewogICAgbWF0Y2goJDAsIC9bMC05XStcLy8pCiAgICBwaWQgPSBzdWJzdHIoJDAsIFJTVEFSVCwgUkxFTkdUSCAtIDEpCiAgICBuYW1lID0gc3Vic3RyKCQwLCBSU1RBUlQgKyBSTEVOR1RIKQoKICAgIHZhcjFbTlIgLSAxXSA9ICQxCiAgICB2YXIyW05SIC0gMV0gPSAkNAogICAgdmFyM1tOUiAtIDFdID0gcGlkCiAgICB2YXI0W05SIC0gMV0gPSBuYW1lCgogICAgbGVuMSA9IGxlbmd0aCh2YXIxW05SIC0gMV0pID4gbGVuMSA/IGxlbmd0aCh2YXIxW05SIC0gMV0pIDogbGVuMQogICAgbGVuMiA9IGxlbmd0aCh2YXIyW05SIC0gMV0pID4gbGVuMiA/IGxlbmd0aCh2YXIyW05SIC0gMV0pIDogbGVuMgogICAgbGVuMyA9IGxlbmd0aCh2YXIzW05SIC0gMV0pID4gbGVuMyA/IGxlbmd0aCh2YXIzW05SIC0gMV0pIDogbGVuMwogICAgbGVuNCA9IGxlbmd0aCh2YXI0W05SIC0gMV0pID4gbGVuNCA/IGxlbmd0aCh2YXI0W05SIC0gMV0pIDogbGVuNAp9CkVORCB7CiAgICBmb3IgKGkgPSAwOyBpIDwgTlI7IGkrKykgewogICAgICAgIHByaW50ZigiJXMiLCB2YXIxW2ldKQogICAgICAgIGZvciAoaiA9IDA7IGogPCBsZW4xIC0gbGVuZ3RoKHZhcjFbaV0pOyBqKyspIHsKICAgICAgICAgICAgcHJpbnRmKCIgIikKICAgICAgICB9CiAgICAgICAgcHJpbnRmKCIgICIpCiAgICAgICAgCiAgICAgICAgcHJpbnRmKCIlcyIsIHZhcjJbaV0pCiAgICAgICAgZm9yIChqID0gMDsgaiA8IGxlbjIgLSBsZW5ndGgodmFyMltpXSk7IGorKykgewogICAgICAgICAgICBwcmludGYoIiAiKQogICAgICAgIH0KICAgICAgICBwcmludGYoIiAgIikKCiAgICAgICAgcHJpbnRmKCIlcyIsIHZhcjNbaV0pCiAgICAgICAgZm9yIChqID0gMDsgaiA8IGxlbjMgLSBsZW5ndGgodmFyM1tpXSk7IGorKykgewogICAgICAgICAgICBwcmludGYoIiAiKQogICAgICAgIH0KICAgICAgICBwcmludGYoIiAgIikKCiAgICAgICAgcHJpbnRmKCIlcyIsIHZhcjRbaV0pCiAgICAgICAgZm9yIChqID0gMDsgaiA8IGxlbjQgLSBsZW5ndGgodmFyNFtpXSk7IGorKykgewogICAgICAgICAgICBwcmludGYoIiAiKQogICAgICAgIH0KICAgICAgICBwcmludGYoIlxuIikKICAgIH0KfScgfCBzb3J0IC11Cg==' | base64 -d >/usr/xbin/dk
echo -n 'IyEvYmluL2Jhc2gKCmlmIFsgISAteiAiJDEiIF07IHRoZW4KICAgIHNlZCAtaSAnc3xcXHxcXFxcXFxcXHxnJyAkMQogICAgc2VkIC1pICdzfFwkfFxcJHxnJyAkMQogICAgc2VkIC1pICdzfCJ8XFxcInxnJyAkMQogICAgc2VkIC1pICc6YTtOOyQhYmE7c3xcbnxcXG58ZycgJDEKCiAgICBpZiBhd2sgLUYgJ1xcXFxuJyAne3ByaW50ICQxfScgJDEgfCBncmVwIC1xICdeIyEnOyB0aGVuCiAgICAgICAgaGVhZD0kKGF3ayAtRiAnXFxcXG4nICd7cHJpbnQgJDF9JyAkMSkKCiAgICAgICAgc2VkIC1pICdzfF4nJGhlYWQnfHByaW50ZiAiJXN8JyAkMQogICAgICAgIHNlZCAtaSAic3xcJHxcIiAnJGhlYWQnfCIgJDEKICAgIGVsc2UKICAgICAgICBzZWQgLWkgJ3N8XnxwcmludGYgInwnICQxCiAgICAgICAgc2VkIC1pICdzfCR8IiB8JyAkMQogICAgZmkKCiAgICBjYXQgJDEKZmkK' | base64 -d >/usr/xbin/ee
echo -n 'IyEvYmluL2Jhc2gKCmlwdGFibGVzIC1GCmlwdGFibGVzIC1YCmlwdGFibGVzIC1aCgo=' | base64 -d >/usr/xbin/iff
echo -n 'IyEvYmluL2Jhc2gKCmlwdGFibGVzIC1TCg==' | base64 -d >/usr/xbin/ifs
echo -n 'IyEvYmluL2Jhc2gKCmlwdGFibGVzIC10IG1hbmdsZSAtRgppcHRhYmxlcyAtdCBtYW5nbGUgLVgKaXB0YWJsZXMgLXQgbWFuZ2xlIC1aCgo=' | base64 -d >/usr/xbin/imf
echo -n 'IyEvYmluL2Jhc2gKCmlwdGFibGVzIC10IG1hbmdsZSAtUwo=' | base64 -d >/usr/xbin/ims
echo -n 'IyEvYmluL2Jhc2gKCmlwdGFibGVzIC10IG5hdCAtRgppcHRhYmxlcyAtdCBuYXQgLVgKaXB0YWJsZXMgLXQgbmF0IC1aCgo=' | base64 -d >/usr/xbin/inf
echo -n 'IyEvYmluL2Jhc2gKCmlwdGFibGVzIC10IG5hdCAtUwo=' | base64 -d >/usr/xbin/ins
echo -n 'IyEvYmluL2Jhc2gKCmlwdGFibGVzIC10IHJhdyAtRgppcHRhYmxlcyAtdCByYXcgLVgKaXB0YWJsZXMgLXQgcmF3IC1aCgo=' | base64 -d >/usr/xbin/irf
echo -n 'IyEvYmluL2Jhc2gKCmlwdGFibGVzIC10IHJhdyAtUwo=' | base64 -d >/usr/xbin/irs
echo -n 'IyEvYmluL2Jhc2gKCmZvcm1hdF9maWxlKCkgewogICAgdmltIC1jICJleGVjdXRlICdub3JtYWwhIGdnPUcnIHwgd3EiICQxCiAgICBzZWQgLWkgInN8XHR8ICAgIHxnOyBzfFs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3NoL2pfa25vd25faG9zdHMpIgp9CgpwYW5lbCgpIHsKICAgIGNvdW50PTEKCiAgICBpZiBbICEgLWUgIn4vLnNzaC9qX2tub3duX2hvc3RzIiBdOyB0aGVuCiAgICAgICAgdG91Y2ggfi8uc3NoL2pfa25vd25faG9zdHMKICAgIGZpCgogICAgZWNobwogICAgcHJpbnRmICIlM3MuIEJhY2tzdGFnZS5zaFxuIiAiJCgoY291bnQrKykpIgogICAgcHJpbnRmICIlM3MuIHBlcnNvbl9zZXR0aW5ncy5zaFxuIiAiJCgoY291bnQrKykpIgogICAgcHJpbnRmICIlM3MuIHN3aXRjaF9vcy5zaFxuIiAiJCgoY291bnQrKykpIgogICAgZWNobwogICAgcHJldHR5X2pfa25vd25faG9zdHMKICAgIGVjaG8KICAgIHJlYWQgLXAgInBsZWFzZSBlbnRlcjogIiBwYW5lbF9pbnB1dAoKICAgIGlmIFsgLXogIiRwYW5lbF9pbnB1dCIgXTsgdGhlbgogICAgICAgIGV4aXQgMAogICAgZWxpZiBbICIkcGFuZWxfaW5wdXQiID0gIjEiIF07IHRoZW4KICAgICAgICBleGVjdXRlX0JhY2tzdGFnZQogICAgZWxpZiBbICIkcGFuZWxfaW5wdXQiID0gIjIiIF07IHRoZW4KICAgICAgICBleGVjdXRlX3BlcnNvbl9zZXR0aW5ncwogICAgZWxpZiBbICIkcGFuZWxfaW5wdXQiID0gIjMiIF07IHRoZW4KICAgICAgICBleGVjdXRlX3N3aXRjaF9vcwogICAgZWxpZiBlY2hvICIkcGFuZWxfaW5wdXQiIHwgZ3JlcCAtcUUgIl5bMC05XStbYS16QS1aXSokIjsgdGhlbgogICAgICAgIHNzaF9yZWNvcmVkZWRfc2VydmVyICRwYW5lbF9pbnB1dAogICAgZWxzZQogICAgICAgIHNzaF9uZXdfc2VydmVyICRwYW5lbF9pbnB1dAogICAgZmkKfQoKaWYgWyAteiAiJDEiIF07IHRoZW4KICAgIHBhbmVsCmVsaWYgWyAtZSAiJDEiIF07IHRoZW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C1ybCAiJE9MRCIgLikKCmZvciByZXppcF9maWxlIGluICR6aXBfZmlsZTtkbwogICAgY2QgJHtyZXppcF9maWxlJS56aXB9CiAgICBybSAtZiAuLi8kcmV6aXBfZmlsZQogICAgemlwIC1xIC1yIC4uLyRyZXppcF9maWxlICoKICAgIGNkIC4uCmRvbmUKCmZvciBybV9maWxlIGluICR6aXBfZmlsZTtkbwogICAgcm0gLXJmICR7cm1fZmlsZSUuemlwfQpkb25lCgo=' | base64 -d >/usr/xbin/spsed
echo -n 'IyEvYmluL2Jhc2gKCmZvciBmaWxlIGluICRAO2RvCgljdXJsIC1zTCAtRiAiZmlsZT1AJGZpbGUiIGh0dHBzOi8vZmlsZS5pbyB8IGF3ayAtRiAnIicgJ3twcmludCAkMTB9Jwpkb25lCg==' | base64 -d >/usr/xbin/uf
chmod +x -R /usr/xbin
echo 'export PATH="$PATH:/usr/xbin"' >>/root/.bashrc
}
install_bash_completion() {
apt install bash-completion -y
cat >>/etc/bash.bashrc <<EOF
# enable bash completion
if [ -f "/etc/bash_completion" ]; then
. /etc/bash_completion
fi
EOF
}
install_common_commands() {
apt install net-tools unzip curl ripgrep bc tree socat -y
}
apt update
set_sshd
set_bash
set_timezone_and_language
set_grub2
set_console_input
install_person_bin
install_bash_completion
install_common_commands