--- tags: Program --- # prefly.sh(系統準備) ```bash= #!/bin/bash apk update &> /dev/null apk upgrade &> /dev/null [ $? = 0 ] && echo "system upgrade ok" for ap in nano bash curl tree sudo grep procps do which $ap &>/dev/null [ "$?" != "0" ] && apk add ${ap} &> /dev/null a[ $? = 0 ] && echo "${ap} add ok" done #讓alpine可以sudo不用密碼 cat /etc/sudoers | grep -x "%wheel ALL=(ALL) NOPASSWD: ALL" &>/dev/null [ $? != 0 ] && echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && echo "sudo Nopasswd OK" #讓alpine ssh時不用確認是否收取server的公鑰 cat /etc/ssh/ssh_config |grep -x "StrictHostKeyChecking no" &>/dev/null [ $? != 0 ] && echo 'StrictHostKeyChecking no' >> /etc/ssh/ssh_config #予許client端可以使用本機的.ssh/environment環境變數 cat /etc/ssh/sshd_config | grep -x "PermitUserEnvironment yes" &>/dev/null [ $? != 0 ] && echo 'PermitUserEnvironment yes' >> /etc/ssh/sshd_config #停用ipv6功能(需要重啟) ifconfig |grep inet6 &>/dev/null [ $? == 0 ] && echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.conf && echo "ivp6 stop ok" #重啟sshd&ssh /etc/init.d/sshd restart #重啟sysctl /etc/init.d/sysctl restart #更改alpin登入歡迎語 echo "Welcom TO Cloud Native Trainer" > /etc/motd #建立第二管理者帳號bigred if [ ! -d /home/bigred ];then adduser -s /bin/bash -h /home/bigred -D bigred addgroup bigred wheel echo -e "bigred\nbigred\n" | passwd bigred &> /dev/null echo "bigred ready" else echo "bigred exist" fi ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up