From 35db3b71ba7de493b8f80a6749ee342f6db9f732 Mon Sep 17 00:00:00 2001 From: gitea Date: Fri, 30 Apr 2021 11:18:00 +0000 Subject: [PATCH] + prepare new linux user for openresty template --- new-user.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 new-user.sh diff --git a/new-user.sh b/new-user.sh new file mode 100644 index 0000000..6cbe0ca --- /dev/null +++ b/new-user.sh @@ -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 \ No newline at end of file