+ prepare new linux user for openresty template
This commit is contained in:
		
							
								
								
									
										16
									
								
								new-user.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								new-user.sh
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,16 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
# This file for openresty template
 | 
			
		||||
# Give only one argument with new user name
 | 
			
		||||
# This replace name of home directory and rename /var/www/yoursite to new username
 | 
			
		||||
# Also it change root path in nginx config
 | 
			
		||||
NEW_USER=$1
 | 
			
		||||
 | 
			
		||||
usermod --login ${NEW_USER} --move-home --home="/home/{$NEW_USER}" yoursite
 | 
			
		||||
 | 
			
		||||
mv /var/www/yoursite /var/www/${NEW_USER}
 | 
			
		||||
 | 
			
		||||
groupmod -n ${NEW_USER} yoursite
 | 
			
		||||
 | 
			
		||||
sed -i "s/yoursite/${NEW_USER}/" /opt/openresty/nginx/conf/conf.d/default.conf
 | 
			
		||||
 | 
			
		||||
systemctl reload openresty
 | 
			
		||||
		Reference in New Issue
	
	Block a user