Last active
June 2, 2018 10:47
-
-
Save jaehoo/4f2f412ced5c079eebd2 to your computer and use it in GitHub Desktop.
Bash commands to create user for tomcat service in Unix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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