u
This commit is contained in:
parent
232f5faa1b
commit
12555bb1cb
9
.bashrc
9
.bashrc
@ -33,12 +33,15 @@ export CVS_RSH=ssh
|
|||||||
|
|
||||||
# Define aliases:
|
# Define aliases:
|
||||||
# Always list long directory and time.
|
# Always list long directory and time.
|
||||||
if uname | grep 'Darwin'; then
|
if [ uname | grep 'Darwin' ]
|
||||||
|
then
|
||||||
alias l='ls -lG'
|
alias l='ls -lG'
|
||||||
alias ll='ls -lGA'
|
alias ll='ls -lGA' # show .xxx
|
||||||
|
alias lll='ls -lGa' # show .xxx and . and ..
|
||||||
else
|
else
|
||||||
alias l='ls -l --color=auto' # --time-style=long-iso --color=auto'
|
alias l='ls -l --color=auto' # --time-style=long-iso --color=auto'
|
||||||
alias ll='ls -Al --color=auto'
|
alias ll='ls -lA --color=auto'
|
||||||
|
alias lll='ls -la --color=auto'
|
||||||
fi
|
fi
|
||||||
#export LS_OPTIONS='--color=auto' # 如果没有指定,则自动选择颜色
|
#export LS_OPTIONS='--color=auto' # 如果没有指定,则自动选择颜色
|
||||||
#export CLICOLOR='Yes' #是否输出颜色
|
#export CLICOLOR='Yes' #是否输出颜色
|
||||||
|
@ -11,22 +11,23 @@ fi
|
|||||||
apt update
|
apt update
|
||||||
apt install -y emacs git curl screen sudo automake
|
apt install -y emacs git curl screen sudo automake
|
||||||
|
|
||||||
|
echo ">>> Making dir /faronear"
|
||||||
if [ ! -d "/faronear" ]
|
if [ ! -d "/faronear" ]
|
||||||
then
|
then
|
||||||
mkdir /faronear
|
mkdir /faronear
|
||||||
fi
|
fi
|
||||||
|
echo ">>> Making dir /faronear/lib"
|
||||||
if [ ! -d "/faronear/lib" ]
|
if [ ! -d "/faronear/lib" ]
|
||||||
then
|
then
|
||||||
mkdir /faronear/lib
|
mkdir /faronear/lib
|
||||||
fi
|
fi
|
||||||
|
echo ">>> Git cloning to /faronear/lib/sysconfig"
|
||||||
if [ ! -d "/faronear/lib/sysconfig" ]
|
if [ ! -d "/faronear/lib/sysconfig" ]
|
||||||
then
|
then
|
||||||
git clone https://git.faronear.org/lib/sysconfig /faronear/lib/sysconfig
|
git clone https://git.faronear.org/lib/sysconfig /faronear/lib/sysconfig
|
||||||
fi
|
fi
|
||||||
|
echo ">>> Configure home"
|
||||||
if [ ! -f "~/.bashrc" ]
|
if [ ! -f "~/.bashrc.backup" ]
|
||||||
then
|
then
|
||||||
. /faronear/lib/sysconfig/setup-home.sh
|
. /faronear/lib/sysconfig/setup-home.sh
|
||||||
fi
|
fi
|
||||||
@ -34,7 +35,7 @@ fi
|
|||||||
echo ">>> Change root password"
|
echo ">>> Change root password"
|
||||||
passwd
|
passwd
|
||||||
|
|
||||||
echo ">>> add a new user"
|
echo ">>> Add a new user"
|
||||||
useradd $User
|
useradd $User
|
||||||
# usermod -a -G sudo $User # 允许该账号进行 sudo 来访问关键资源
|
# usermod -a -G sudo $User # 允许该账号进行 sudo 来访问关键资源
|
||||||
passwd $User
|
passwd $User
|
||||||
@ -46,30 +47,32 @@ sed -i "s/\/home\/$User:\/bin\/sh$/\/home\/$User:\/bin\/bash/g" /etc/passwd
|
|||||||
# Debian 9 默认为空。
|
# Debian 9 默认为空。
|
||||||
sed -i "s/\/home\/$User:$/\/home\/$User:\/bin\/bash/g" /etc/passwd
|
sed -i "s/\/home\/$User:$/\/home\/$User:\/bin\/bash/g" /etc/passwd
|
||||||
|
|
||||||
|
echo ">>> Allow sudo without password: %sudo ALL=(ALL:ALL) NOPASSWD:ALL"
|
||||||
echo ">>> allow sudo without password: %sudo ALL=(ALL:ALL) NOPASSWD:ALL"
|
|
||||||
chmod o+w /etc/sudoers
|
chmod o+w /etc/sudoers
|
||||||
# emacs /etc/sudoers
|
# emacs /etc/sudoers
|
||||||
sed -i "s/%sudo\s\+ALL=(ALL:ALL)\sALL/%sudo\tALL=(ALL:ALL) NOPASSWD:ALL/g" /etc/sudoers
|
sed -i "s/%sudo\s\+ALL=(ALL:ALL)\sALL/%sudo\tALL=(ALL:ALL) NOPASSWD:ALL/g" /etc/sudoers
|
||||||
chmod o-w /etc/sudoers
|
chmod o-w /etc/sudoers
|
||||||
|
|
||||||
echo ">>> disallow root login: #PermitRootLogin yes"
|
echo ">>> Disallow root login: #PermitRootLogin yes"
|
||||||
# emacs /etc/ssh/sshd_config
|
# emacs /etc/ssh/sshd_config
|
||||||
sed -i "s/^PermitRootLogin yes/#PermitRootLogin yes/g" /etc/ssh/sshd_config
|
sed -i "s/^PermitRootLogin yes/#PermitRootLogin yes/g" /etc/ssh/sshd_config
|
||||||
service sshd restart
|
service sshd restart
|
||||||
|
|
||||||
echo ">>> config autostart"
|
echo ">>> Configure autostart"
|
||||||
|
if [ -f /etc/rc.local ]
|
||||||
|
then
|
||||||
mv /etc/rc.local /etc/rc.local.backup
|
mv /etc/rc.local /etc/rc.local.backup
|
||||||
|
fi
|
||||||
touch /etc/rc.local
|
touch /etc/rc.local
|
||||||
chmod +x /etc/rc.local
|
chmod +x /etc/rc.local
|
||||||
echo '#!/bin/bash' > /etc/rc.local # can't omit, otherwise you can't launch pm2 in autostart.sh. Don't use double quote here, otherwise error.
|
echo '#!/bin/bash' > /etc/rc.local # can't omit, otherwise you can't launch pm2 in autostart.sh. Don't use double quote here, otherwise error.
|
||||||
echo 'source /faronear/autostart.sh' >> /etc/rc.local # make sure to sudo pm2 in autostart.sh, otherwise pm2 list can't find it as root.
|
echo 'source /faronear/autostart.sh' >> /etc/rc.local # make sure to sudo pm2 in autostart.sh, otherwise pm2 list can't find it as root.
|
||||||
touch /faronear/autostart.sh
|
touch /faronear/autostart.sh
|
||||||
chmod +x /faronear/autostart.sh
|
chmod +x /faronear/autostart.sh
|
||||||
echo '<<< autostart is set. You can "systemctl start/stop/status rc-local" to manage it.'
|
echo '<<< Autostart is set. You can "systemctl start/stop/status rc-local" to manage it.'
|
||||||
|
|
||||||
echo ">>> configure locales: install all-locales, default to zh-CN.UTF-8"
|
echo ">>> Configure locales: install all-locales, default to zh-CN.UTF-8"
|
||||||
# dpkg-reconfigure locales
|
dpkg-reconfigure locales
|
||||||
|
|
||||||
echo "系统设置完毕。"
|
echo "系统设置完毕。"
|
||||||
echo "远程服务器使用策略:"
|
echo "远程服务器使用策略:"
|
||||||
|
Loading…
Reference in New Issue
Block a user