Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
Shells Virtual Desktop

In this Discussion

New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Permission settings for everyday sftp user

I'd like to add a separate user from root to the system for sftp and administration purposes. The following would be for Ubuntu 14.04. Any pitfalls to the following method of adding the user 'dev' to the www-data group? I want to make sure that anything uploaded by that user through sftp can be read/executed by php & apache. Thanks.

adduser dev # Add user to sudo group gpasswd -a dev sudo ## Copy ssh key to new user's directory ## On LOCAL COMPUTER, run the following command & copy result to clipboard cat ~/.ssh/id_rsa.pub ## While logged in as root user, issue following cmd to change to dev user su - dev ## Create the .ssh directory and the keys file mkdir .ssh chmod 700 .ssh vi .ssh/authorized_keys ## paste in the ssh key you copied earlier. Now change permissions on the file chmod 600 .ssh/authorized_keys ## exit back to root exit # Add devuser to www-data, to allow for sftp file uploads usermod -a -G www-data dev # Set user's home directory - where they land when they SFTP in. usermod -d /var/www/html dev

Comments

  • AICAIC Member

    @boxelder said:
    I'd like to add a separate user from root to the system for sftp and administration purposes. The following would be for Ubuntu 14.04. Any pitfalls to the following method of adding the user 'dev' to the www-data group? I want to make sure that anything uploaded by that user through sftp can be read/executed by php & apache. Thanks.

    adduser dev # Add user to sudo group gpasswd -a dev sudo ## Copy ssh key to new user's directory ## On LOCAL COMPUTER, run the following command & copy result to clipboard cat ~/.ssh/id_rsa.pub ## While logged in as root user, issue following cmd to change to dev user su - dev ## Create the .ssh directory and the keys file mkdir .ssh chmod 700 .ssh vi .ssh/authorized_keys ## paste in the ssh key you copied earlier. Now change permissions on the file chmod 600 .ssh/authorized_keys ## exit back to root exit # Add devuser to www-data, to allow for sftp file uploads usermod -a -G www-data dev # Set user's home directory - where they land when they SFTP in. usermod -d /var/www/html dev

    You can find the details for centos as well for ubuntu.
    http://techinfozone.net/?s=sftp

Sign In or Register to comment.