Linux useradd passwd: создание учетных записей с доступом в определенную папку

Иногда, необходимо создать дополнительный FTP аккаунт с возможностью доступа в определенную подпапку.
Это можно сделать командами:

# useradd -d /home/taras/public_html -g taras -o -s /bin/false -u 10001 ftp_taras_web
# passwd ftp_taras_web

Параметры команды useradd из man страницы useradd:
-d, —home HOME_DIR
The new user will be created using HOME_DIR as the value for the user’s login directory. The default is to append the LOGIN name to BASE_DIR and use that as the login directory
name. The directory HOME_DIR does not have to exist but will not be created if it is missing.

-g, —gid GROUP
The group name or number of the user’s initial login group. The group name must exist. A group number must refer to an already existing group. /etc/default/useradd.

-o, —non-unique
Allow the creation of a user account with a duplicate (non-unique) UID.

-s, —shell SHELL
The name of the user’s login shell. The default is to leave this field blank, which causes the system to select the default login shell.

-u, —uid UID
The numerical value of the user’s ID. This value must be unique, unless the -o option is used. The value must be non-negative. The default is to use ID value equal to or
greater than UID_MIN and smaller then UID_MAX. Values between 0 and UID_MIN are typically reserved for system accounts.

Можно использовать мой генератор паролей, чтобы получить хороший сложный пароль.

Данные о пользователе можно получить командами id и finger:

# id taras
uid=1001(taras) gid=1001(taras) groups=1001(taras)

# finger taras
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.
создание сайтов на основе Drupal 7+ любой сложности, Киев
 
Copyright © 2013 - 2024 Шкоденко Тарас. Програмування та розробка сайтів