Skip to content

Instantly share code, notes, and snippets.

@yukal
Last active July 31, 2019 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yukal/c584f960d6a0e3e0b79c7710b7cf5fc0 to your computer and use it in GitHub Desktop.
Save yukal/c584f960d6a0e3e0b79c7710b7cf5fc0 to your computer and use it in GitHub Desktop.
Create a system account www-data with the same UID and GID
# Create www-data account
useradd -s /sbin/nologin -d /var/www -r -M -U -u 777 www-data
# Set the ownership to www directory
# chown -R root:www-data /var/www
chown -R www-data:www-data /var/www
# Set permissions of child files and directories inside the www directory
find /var/www -type d -exec chmod 2775 {} +
find /var/www -type f -exec chmod 0664 {} +
# Append nginx user to www-data group
usermod -aG www-data nginx
# Append mysql user to www-data group
usermod -aG www-data mysql
# Check info
id www-data && id nginx && id mysql
ls -la /var | grep www-data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment