u
This commit is contained in:
		
							parent
							
								
									f758f5c68c
								
							
						
					
					
						commit
						eea6e4afdd
					
				
							
								
								
									
										1
									
								
								exec-change-hook-path.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								exec-change-hook-path.sh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | |||||||
|  | sed -i "s/\/home\/fon\//\/root\//g" `grep '/home/fon' -rl git.repo/*/*/hooks` | ||||||
							
								
								
									
										1
									
								
								exec-rsync2remote.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								exec-rsync2remote.sh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | |||||||
|  | rsync -rvz -e ssh -p 22000 --progress ./git.repo adot@west-cn.yuanjin.net:/home/adot/ | ||||||
| @ -11,17 +11,24 @@ fi | |||||||
| apt update | apt update | ||||||
| apt install -y emacs git curl screen sudo automake | apt install -y emacs git curl screen sudo automake | ||||||
| 
 | 
 | ||||||
|  | mkdir /faronear | ||||||
|  | mkdir /faronear/lib | ||||||
|  | 
 | ||||||
| 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 | ||||||
| mkdir /home/$User | mkdir /home/$User | ||||||
| chown $User:$User /home/$User | chown $User:$User /home/$User | ||||||
| # emacs /etc/passwd | # emacs /etc/passwd | ||||||
| sed -i "s/\/home\/$User:/\/home\/$User:\/bin\/bash/g" /etc/passwd | # Debian 10 默认已经设了 /bin/sh | ||||||
|  | sed -i "s/\/home\/$User:\/bin\/sh$/\/home\/$User:\/bin\/bash/g" /etc/passwd | ||||||
|  | # Debian 9 默认为空。 | ||||||
|  | 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 | ||||||
| @ -30,8 +37,8 @@ sed -i "s/%sudo\s\+ALL=(ALL:ALL)\sALL/%sudo\tALL=(ALL:ALL) NOPASSWD:ALL/g" /etc/ | |||||||
| chmod o-w /etc/sudoers | chmod o-w /etc/sudoers | ||||||
| 
 | 
 | ||||||
| echo ">>> disallow root login: #PermitRootLogin yes" | echo ">>> disallow root login: #PermitRootLogin yes" | ||||||
| sed -i "s/^PermitRootLogin yes/#PermitRootLogin yes/g" /etc/ssh/sshd_config |  | ||||||
| # emacs /etc/ssh/sshd_config | # emacs /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 ">>> config autostart" | ||||||
| @ -39,15 +46,18 @@ mv /etc/rc.local /etc/rc.local.backup | |||||||
| 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 /root/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 /root/autostart.sh | touch /faronear/autostart.sh | ||||||
| chmod +x /root/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 "* 统一使用 debian 系统。" | echo "* 统一使用 debian 系统。" | ||||||
| echo "* 禁止 root 用户远程登录,另建 adot 用户用于登录。" | echo "* 禁止 root 用户远程登录,另建 adot (admin+root) 用户用于远程登录。" | ||||||
| echo "* 管理员用 adot 账号登录后,su 到 /root 目录下安装、设置服务软件。" | echo "* 软件、配置安装在 /faronear 目录下,尽量保持与 git 仓库的路径一致,例如 /faronear/tic/wallet/dist/" | ||||||
|  | echo "* /faronear 允许 adot 访问,但必须把其中机密文件的权限设置到最小。" | ||||||
|  | echo "* 用 adot 账号远程登录后,su 后启动软件。" | ||||||
|  | |||||||
							
								
								
									
										5
									
								
								setup-homebrew.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								setup-homebrew.sh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | |||||||
|  | echo "Installing Homebrew on MacOS" | ||||||
|  | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | ||||||
|  | 
 | ||||||
|  | # uninstall: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)" | ||||||
|  | # install emacs: brew cask install emacs | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user