Skip to content

Shkodenko Taras

web development and system administration of Linux

  • Drawing
  • PHP Mentorship Program
  • Privacy Policy
  • About

Linux useradd passwd: create accounts with access to a specific folder

February 9, 2024 ~ tadmin

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.

Share This Blog Post

Posted in Linux access controlFTP accessFTP accountLinux serverpasswd commandpassword generatorpermissionsSecurityserver administrationsubfolder accessuser accountsuser authenticationuser managementuser permissionsuser privilegesuseradd command

Published by tadmin

View all posts by tadmin

Post navigation

‹ PreviousTrimming the Last Character from a String in Bash
Next ›Linux chkconfig and service: managing autostart and service state

Support My Work!

Categories

  • Apache
  • CMS
  • Docker
  • Drupal
  • Git
  • Laravel
  • Lean
  • Linux
  • macOs
  • Magento
  • MySQL | MariaDB
  • Nginx
  • PHP
  • Pimcore CMS
  • Plesk
  • PostgreSQL
  • Server configuration
  • Symfony
  • Uncategorized
  • WordPress
  • Yii2
DigitalOcean Referral Badge

Tags

.htaccess Apache archive array bash certificate composer diff docker Drupal ffmpeg find git git best practices grep IPTables Laravel Laravel best practices Laravel tips Linux Linux file management MySQL mysqldump Odin openssl PHP PHP development Pimcore Plesk PostgreSQL ProFTPD script Security sed shell software development ssh ssl Symfony system administration tar ubuntu web development wordpress zip

Donations

You can support this project if you like what I'm writing

Recent Posts

  • How to create a simple IP address tracker with geolocation in Symfony 6+
  • How to Open Unverified Apps on macOS: MarkText Example
  • What is Docker and Why Developers Should Care
  • Service Classes in Laravel: Clean Architecture and Scalability
  • 🧭 What is Symfony? And How Is It Different from Laravel?
  • Laravel Facades Uncovered: Convenient, but Always Safe?
  • 🎧 How to Convert and Combine Multiple iPhone .m4a Audio Files into One .mp3 on Linux using ffmpeg

Search

  • GitHub
  • YouTube
  • Telegram
  • Patreon
  • Instagram
  • Pinterest
Buy Me a Coffee ☕
Proudly powered by WordPress ~ Theme: Shcom-child by Taras Shkodenko.