Skip to content

Instantly share code, notes, and snippets.

@Tantas
Created August 6, 2014 00:13
Show Gist options
  • Save Tantas/131327c787f9eff61d14 to your computer and use it in GitHub Desktop.
Save Tantas/131327c787f9eff61d14 to your computer and use it in GitHub Desktop.
Creates a tomcat run user.
#!/bin/bash
# Create a tomcat run user and apply ownership.
# Example used for DotCMS.
echo "This is a guide. Do not execute this as a script."
exit -1
# Create a group with no permissions
sudo groupadd dotcmsusers
# Create a dotcms user, with no home directory and ssh no login
sudo useradd -M -g dotcmsusers -s /sbin/nologin dotcmsuser
# Lock the account, it is still possible to 'su' into a locked account
sudo usermod -L dotcmsuser
# Give ownership of the dotcms directory to the dotcmsuser
sudo chown -R dotcmsuser:dotcmsusers /opt/dotcms/dotserver
# Update the service script to use the new user
# /bin/su - dotcmsuser -c ${START_DOTCMS}
# /bin/su - dotcmsuser -c ${STOP_CMS}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment