Skip to content

Instantly share code, notes, and snippets.

@Neolot
Created December 21, 2015 13:31
Show Gist options
  • Save Neolot/fd0ca1a6e10616c0f54d to your computer and use it in GitHub Desktop.
Save Neolot/fd0ca1a6e10616c0f54d to your computer and use it in GitHub Desktop.
Add webuser for linux
#!/bin/sh
echo -n "Enter username (short sitename):"
read user
useradd $user -b /var/www/ -m -U -s /bin/false
passwd $user
usermod -a -G sftpusers $user
usermod -a -G $user www-data
chmod 754 /var/www/$user
mkdir -p -m 754 /var/www/$user/public_html/www
mkdir -p -m 777 /var/www/$user/tmp
chmod +t /var/www/$user/tmp
chown -R $user:$user /var/www/$user/
chown -R $user:www-data /var/www/$user/public_html/www
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment