sh 创建新SFTP用户/帐户的步骤

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 创建新SFTP用户/帐户的步骤相关的知识,希望对你有一定的参考价值。

#### 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 <new_user> 

#### 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 <new_user>  

#### 4 Add user to the ServerPilot Group for permission
usermod -a -G serverpilot <new_user>

#### 5 Check permission
ls -ld /srv/users/serverpilot/apps/ # 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 :serverpilot /srv/users/serverpilot/apps/  # 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/ # 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 <new_user>

以上是关于sh 创建新SFTP用户/帐户的步骤的主要内容,如果未能解决你的问题,请参考以下文章

Linux设置SFTP服务用户目录权限

Linux设置SFTP服务用户目录权限

Linux设置SFTP服务用户目录权限

linux帐户安全管理与技巧

为 sftp 帐户设置 umask?

text 用于创建新SFTP用户的命令