Howdy, Stranger!

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


In this Discussion

Permission settings for everyday sftp user
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.