Skip to content

Instantly share code, notes, and snippets.

@sam-suresh
Forked from edheltzel/ADD_SFTP_User.md
Last active August 13, 2019 22:32
Show Gist options
  • Save sam-suresh/cf4ab06567b71e034bf3e54348917a47 to your computer and use it in GitHub Desktop.
Save sam-suresh/cf4ab06567b71e034bf3e54348917a47 to your computer and use it in GitHub Desktop.
steps to create new SFTP user/account
#### This is mainly for VMs managed by ServerPilot control panel using Ubuntu 14.04
#### But in theory will work for VMs in general ie: DigitalOcean or AWS instance
#### 1 Add new user
useradd mudotmy
#### 2 Follow on screen prompts - this will allow SFTP with the password set from the prompts
#### If there are no prompts just move on to Step 3 You will reset the password in the last step
#### 3 Update user's home directory to ServerPilots Apps OR vim /etc/passwd to change the new users path
usermod -d /srv/users/serverpilot/apps/preview/public mudotmy
#### 4 Add user to the ServerPilot Group for permission
usermod -a -G mudotmy mudotmy
#### 5 Check permission
ls -ld /srv/users/serverpilot/apps/preview/public # should look like drwxr-xr-x 2 root serverpilot 4096 Jan 27 09:08 /srv/users/serverpilot/apps/
#### 6 Add read write execute permission to ServerPilot Group
chown -vR :mudotmy /srv/users/serverpilot/apps/preview/public # changed ownership of /srv/users/serverpilot/apps/ from root:root to :serverpilot
#### 7 Grant write permission to the group owner
chmod -vR g+w /srv/users/serverpilot/apps/preview/public # changed from 0755 (rwxr-xr-x) to 0775 (rwxrwxr-x)
#### 8 change password of the new user (only if prompt didn't work)
sudo passwd mudotmy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment