助け合いフォーラム

LPIC

LPIC Lv1-102(Ver5.0)
問題ID : 4656
問題を開く
useraddコマンドでオプションを指定せずにユーザを作成する際、使用されるデフォルトの値が格納されているファイルは次のうちどれか。

この問題はプレミアムコンテンツです。

上に戻る

/etc/default/useraddと/etc/skelの違いについて

公開日 2023/03/03

お世話になります。

Useraddコマンドを使用した際、デフォルト値として参照するファイルとして、
/etc/default/useradd

/etc/skel
の2つがあるかと思いますが、2つの違いがよくわかりません。

恐れ入りますが、ご教示いただけますと幸いです。

2023/03/04 09:05

/etc/skelディレクトリには、ユーザが新たに作成された際に、そのユーザのホームディレクトリにコピーされるディレクトリやファイルが配置されています。

user@debian:~$ ls -a /etc/skel
.  ..  .bash_logout  .bashrc  .profile

/etc/default/useraddファイルは、新たに作成されるユーザのデフォルトの設定を定義するファイルです。
そのファイルで定義されている変数の一部の意味は以下の通りです。

SHELL: ログインシェル
GROUP: グループID(GID)
HOME: ホームディレクトリ

user@debian:~$ cat /etc/default/useradd
# Default values for useradd(8)
#
# The SHELL variable specifies the default login shell on your
# system.
# Similar to DSHELL in adduser. However, we use "sh" here because
# useradd is a low level utility and should be as general
# as possible
SHELL=/bin/sh
#
# The default group for users
# 100=users on Debian systems
# Same as USERS_GID in adduser
# This argument is used when the -n flag is specified.
# The default behavior (when -n and -g are not specified) is to create a
# primary user group with the same name as the user being added to the
# system.
# GROUP=100
#
# The default home directory. Same as DHOME for adduser
# HOME=/home
#
# The number of days after a password expires until the account 
# is permanently disabled
# INACTIVE=-1
#
# The default expire date
# EXPIRE=
#
# The SKEL variable specifies the directory containing "skeletal" user
# files; in other words, files such as a sample .profile that will be
# copied to the new user's home directory when it is created.
# SKEL=/etc/skel
#
# Defines whether the mail spool should be created while
# creating the account
# CREATE_MAIL_SPOOL=yes


コメント

T Tenpa_

2023/03/05 10:28

nagutabby様 ご教示いただきありがとうございます。 新規作成したユーザーの特性を指定するか、もしくはフォルダなどを指定するかの違いなのですね。 とてもわかりやすかったです。 ありがとうございました。

n nagutabby

2023/03/06 07:26

ご質問ありがとうございました〜。私もちょうど同じ試験を学習中だったので、回答していて私も勉強になりました。

この返信に対して
コメントを記入できます

この投稿に対して返信しませんか?