Skip to content

Instantly share code, notes, and snippets.

@jaehoo
Last active June 2, 2018 10:47
Show Gist options
  • Save jaehoo/4f2f412ced5c079eebd2 to your computer and use it in GitHub Desktop.
Save jaehoo/4f2f412ced5c079eebd2 to your computer and use it in GitHub Desktop.
Bash commands to create user for tomcat service in Unix
#Create group and user
groupadd tomcat
useradd -r -m -d ${USR_TOMCAT_HOME_DIR} -s /bin/false tomcat -g tomcat
# In debian distro you can use this alternative
useradd -r -m -d ${USR_TOMCAT_HOME_DIR} -s /sbin/nologin tomcat -g tomcat
#set user password
passwd tomcat
#Change folder privilegies
chown -R tomcat.tomcat /path/to/tomcat
chmod 775 /path/to/tomcat/webapps
#start or stop server
sudo -u tomcat /opt/tomcat/bin/startup.sh
sudo -u tomcat /opt/tomcat/bin/shutdown.sh
#if you have normal or admin user you need these commands:
su - tomcat -c /opt/tomcat/bin/startup.sh
su - tomcat -c /opt/tomcat/bin/shutdown.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment