Use adduser instead of useradd for adding new users on terminal and change home-directory

Recommend using adduser (instead of useradd) for adding new users. It’s more user friendly.

adduser xxx

Modify user’s home directory

usermod -d /var/www/directory xxxusername

Modify user’s home directory while copying existing home files

usermod -m -d /newhome/username username

Give appropriate permission to new directory

sudo chown -R newuser:www-data /var/www/new/directory/


Add userX to group sftp

sudo usermod -G sftp userX

If you wish to grant sudo privileges to new user

sudo usermod -aG sudo newusername

Leave a Comment

Your email address will not be published. Required fields are marked *