リナックス コマンド useradd ユーザ作成
【説明】
useraddコマンドは
新規にユーザアカウントを作成するコマンドです。
スーパーユーザのみ実行可能です。
su - root にてスーパユーザに変更後
useraddを実行できます。
【構文】
Usage: useradd [options] LOGIN
Options:
-b, --base-dir BASE_DIR base directory for the new user account
home directory
-c, --comment COMMENT set the GECOS field for the new user account
-d, --home-dir HOME_DIR home directory for the new user account
-D, --defaults print or save modified default useradd
configuration
-e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-f, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-g, --gid GROUP force use GROUP for the new user account
-G, --groups GROUPS list of supplementary groups for the new
user account
-h, --help display this help message and exit
-k, --skel SKEL_DIR specify an alternative skel directory
-K, --key KEY=VALUE overrides /etc/login.defs defaults
-l, do not add the user to the lastlog and
faillog databases
-m, --create-home create home directory for the new user
account
-M, do not create user's home directory(overrides /etc/login.defs)
-N, --no-user-group do not create a group with the same name as
the user
-o, --non-unique allow create user with duplicate
(non-unique) UID
-p, --password PASSWORD use encrypted password for the new user
account
-r, --system create a system account
-s, --shell SHELL the login shell for the new user account
-u, --uid UID force use the UID for the new user account
-U, --user-group create a group with the same name as the user
-Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
【-cオプション 例】
[root@localhost ~]# useradd -c izu azuki
useradd: ユーザ azuki は存在します
[root@localhost ~]# useradd -c commanduser user_name
[root@localhost ~]# su - user_name
[user_name@localhost ~]$ exit
logout
[root@localhost ~]# useradd -c comment user_name
useradd: ユーザ user_name は存在します
【-bオプション 例】
[root@localhost ~]# useradd -b /home oguraan
[root@localhost ~]# ls -l /home/oguraan
合計 0
[root@localhost ~]# su - oguraan
[oguraan@localhost ~]$
【-dオプション 例】
[root@localhost ~]# useradd -d /home/takuan takuan
[root@localhost ~]# ls -l /home/takuan
合計 0
[root@localhost ~]# su - takuan
[takuan@localhost ~]$ pwd
/home/takuan
[takuan@localhost ~]$
「この記事は役に立ちました。」という場合には
ブログランキングボタンをクリックしていただけると大変、助かります。
●ブログランキング
【説明】
useraddコマンドは
新規にユーザアカウントを作成するコマンドです。
スーパーユーザのみ実行可能です。
su - root にてスーパユーザに変更後
useraddを実行できます。
【構文】
Usage: useradd [options] LOGIN
Options:
-b, --base-dir BASE_DIR base directory for the new user account
home directory
-c, --comment COMMENT set the GECOS field for the new user account
-d, --home-dir HOME_DIR home directory for the new user account
-D, --defaults print or save modified default useradd
configuration
-e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-f, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-g, --gid GROUP force use GROUP for the new user account
-G, --groups GROUPS list of supplementary groups for the new
user account
-h, --help display this help message and exit
-k, --skel SKEL_DIR specify an alternative skel directory
-K, --key KEY=VALUE overrides /etc/login.defs defaults
-l, do not add the user to the lastlog and
faillog databases
-m, --create-home create home directory for the new user
account
-M, do not create user's home directory(overrides /etc/login.defs)
-N, --no-user-group do not create a group with the same name as
the user
-o, --non-unique allow create user with duplicate
(non-unique) UID
-p, --password PASSWORD use encrypted password for the new user
account
-r, --system create a system account
-s, --shell SHELL the login shell for the new user account
-u, --uid UID force use the UID for the new user account
-U, --user-group create a group with the same name as the user
-Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
【-cオプション 例】
[root@localhost ~]# useradd -c izu azuki
useradd: ユーザ azuki は存在します
[root@localhost ~]# useradd -c commanduser user_name
[root@localhost ~]# su - user_name
[user_name@localhost ~]$ exit
logout
[root@localhost ~]# useradd -c comment user_name
useradd: ユーザ user_name は存在します
【-bオプション 例】
[root@localhost ~]# useradd -b /home oguraan
[root@localhost ~]# ls -l /home/oguraan
合計 0
[root@localhost ~]# su - oguraan
[oguraan@localhost ~]$
【-dオプション 例】
[root@localhost ~]# useradd -d /home/takuan takuan
[root@localhost ~]# ls -l /home/takuan
合計 0
[root@localhost ~]# su - takuan
[takuan@localhost ~]$ pwd
/home/takuan
[takuan@localhost ~]$
「この記事は役に立ちました。」という場合には
ブログランキングボタンをクリックしていただけると大変、助かります。
●ブログランキング



