How to Create an Additional FTP Account with Access to a Specific Subfolder
Sometimes, managing access to specific directories on your server is essential for security and organization purposes. One common scenario is creating an additional FTP account with access limited to a particular subfolder. In this guide, we’ll walk through the steps to achieve this on a Linux-based system.
Step 1: Creating the User Account
First, let’s create a new user account using the `useradd` command. Replace `ftp_taras_web` with your desired username and `/home/taras/public_html` with the path to the subfolder you want to grant access to.
sudo useradd -d /home/taras/public_html -g taras -o -s /bin/false -u 10001 ftp_taras_web
Here’s a breakdown of the parameters used in the command:
- -d, -home HOME_DIR: Specifies the home directory for the new user.
- -g, -gid GROUP: Sets the initial login group for the user.
- -o, -non-unique: Allows the creation of a user account with a duplicate UID.
- -s, -shell SHELL: Specifies the login shell for the user.
- -u, -uid UID: Sets the numerical value of the user’s ID.
Step 2: Setting the Password
Next, set a password for the newly created FTP account using the `passwd` command:
sudo passwd ftp_taras_web
Step 3: Generating a Complex Password
For enhanced security, consider using a password generator to create a strong and complex password for the FTP account.
Step 4: Verifying User Data
You can verify the user’s information using the `id` and `finger` commands:
id ftp_taras_web
uid=1001(taras) gid=1001(taras) groups=1001(taras)
finger ftp_taras_web
Login: taras Name: Directory: /home/taras Shell: /bin/bash Last login Wed Dec 26 13:48 (EET) on pts/4 from 192.168.2.1 No mail. No Plan.
This will display details such as the user ID, group ID, home directory, and login shell.
By following these steps, you can efficiently manage access permissions for specific directories on your server, ensuring a secure and organized environment.