RedHat Red Hat Certified System Administrator - RHCSA (EX200日本語版) - EX200日本語 Exam Practice Test
ユーザーが作成したファイルのデフォルトのUMASKを設定する
ユーザーのnatashaさんへ:
* 新しく作成されたファイルのデフォルトのパーミッションは r--r--r-- です。
* 新しく作成されたディレクトリのデフォルトのパーミッションは r-xr-xr-x であるべきです
ユーザーのnatashaさんへ:
* 新しく作成されたファイルのデフォルトのパーミッションは r--r--r-- です。
* 新しく作成されたディレクトリのデフォルトのパーミッションは r-xr-xr-x であるべきです
Correct Answer:
Solution:
# su - natasha
Write the umask setting into the user's .bashrc file in the home directory:
bash
Copy code
echo 'umask 222' >> .bashrc
source .bashrc
Command explanation:
umask is used to control the default permissions for files and directories created by a user.
In umask:
The first digit is for special permissions and is usually 0 (can be omitted if not needed).
The second digit controls owner permissions.
The third digit controls group permissions.
The fourth digit controls permissions for others.
# su - natasha
Write the umask setting into the user's .bashrc file in the home directory:
bash
Copy code
echo 'umask 222' >> .bashrc
source .bashrc
Command explanation:
umask is used to control the default permissions for files and directories created by a user.
In umask:
The first digit is for special permissions and is usually 0 (can be omitted if not needed).
The second digit controls owner permissions.
The third digit controls group permissions.
The fourth digit controls permissions for others.
デフォルトのパスワードポリシーを設定します
新規作成ユーザーに対してパスワードポリシーを設定し、ユーザー作成時にパスワードがデフォルトで25日後に期限切れになるようにします。
新規作成ユーザーに対してパスワードポリシーを設定し、ユーザー作成時にパスワードがデフォルトで25日後に期限切れになるようにします。
Correct Answer:
Solution:
[root@node1 ~]# vim /etc/login.defs +25
Type / and search for PASS_MAX_DAYS.
Modify it to:
PASS_MAX_DAYS 25
Verify:
[root@node1 ~]# useradd user1
[root@node1 ~]# chage -l user1
[root@node1 ~]# vim /etc/login.defs +25
Type / and search for PASS_MAX_DAYS.
Modify it to:
PASS_MAX_DAYS 25
Verify:
[root@node1 ~]# useradd user1
[root@node1 ~]# chage -l user1
共有ディレクトリを作成する
以下の特性を持つ共有ディレクトリを作成します。
* /home/test のグループ所有者は admins です。
* 管理者グループのメンバーは、このディレクトリの読み取り、書き込み、およびアクセス権限を持ちます。root以外のユーザーには、これらの権限はありません。
* このディレクトリ内に作成されたファイルは、自動的に管理者グループにグループ所有者が設定されます。
以下の特性を持つ共有ディレクトリを作成します。
* /home/test のグループ所有者は admins です。
* 管理者グループのメンバーは、このディレクトリの読み取り、書き込み、およびアクセス権限を持ちます。root以外のユーザーには、これらの権限はありません。
* このディレクトリ内に作成されたファイルは、自動的に管理者グループにグループ所有者が設定されます。
Correct Answer:
Solution:
Create the group:
[root@node1 ~]# groupadd admins
Create the directory:
[root@node1 ~]# mkdir /home/test
Set the group ownership:
[root@node1 ~]# chgrp admins /home/test
Set the permissions:
[root@node1 ~]# chmod 2770 /home/test
Verify:
[root@node1 ~]# ls -ld /home/test
drwxrws--- root admins /home/test
Create the group:
[root@node1 ~]# groupadd admins
Create the directory:
[root@node1 ~]# mkdir /home/test
Set the group ownership:
[root@node1 ~]# chgrp admins /home/test
Set the permissions:
[root@node1 ~]# chmod 2770 /home/test
Verify:
[root@node1 ~]# ls -ld /home/test
drwxrws--- root admins /home/test
sudo権限設定を追加する
sysmgrsグループのメンバーがパスワードを入力せずにsudoを使用できるようにする。
sysmgrsグループのメンバーがパスワードを入力せずにsudoを使用できるようにする。
Correct Answer:
Solution:
[root@node1 ~]# visudo
...
%wheel ALL=(ALL) NOPASSWD: ALL
%sysmgrs ALL=(ALL) NOPASSWD: ALL
# Verification (mandatory operation)
[root@node1 ~]# su - natasha
[natasha@node1 ~]# sudo cat /etc/shadow
[root@node1 ~]# visudo
...
%wheel ALL=(ALL) NOPASSWD: ALL
%sysmgrs ALL=(ALL) NOPASSWD: ALL
# Verification (mandatory operation)
[root@node1 ~]# su - natasha
[natasha@node1 ~]# sudo cat /etc/shadow
/dev/sdc 上に pool1 という名前の Stratis プールを作成し、fs1 という名前のファイルシステムを作成します。
Correct Answer:
See the solution below in Explanation.
Explanation:
Solution:
dnf install -y stratisd stratis-cli
systemctl enable --now stratisd
stratis pool create pool1 /dev/sdc
stratis filesystem create pool1 fs1
stratis filesystem list
Detailed Explanation:
* stratisd is the daemon and stratis-cli provides the command-line interface.
* A Stratis pool is created from a block device.
* The Stratis file system is then created inside that pool.
* RHEL 10 documents Stratis as an available volume-managing file-system layer. ( Red Hat
Documentation )
Explanation:
Solution:
dnf install -y stratisd stratis-cli
systemctl enable --now stratisd
stratis pool create pool1 /dev/sdc
stratis filesystem create pool1 fs1
stratis filesystem list
Detailed Explanation:
* stratisd is the daemon and stratis-cli provides the command-line interface.
* A Stratis pool is created from a block device.
* The Stratis file system is then created inside that pool.
* RHEL 10 documents Stratis as an available volume-managing file-system layer. ( Red Hat
Documentation )
論理ボリュームを作成する
指定された要件に従って、新しい論理ボリュームを作成します。
- ボリュームグループ「myvg」に属する「mylv」という名前の論理ボリューム。サイズは50エクステント。
- ボリュームグループ「myvg」内の論理ボリュームのエクステントサイズは16 MiBである必要があります。
- 新しい論理ボリュームをVFATファイルシステムでフォーマットします。
- 論理ボリュームは、システム起動時に/mnt/mydataに自動的にマウントされる必要があります。
指定された要件に従って、新しい論理ボリュームを作成します。
- ボリュームグループ「myvg」に属する「mylv」という名前の論理ボリューム。サイズは50エクステント。
- ボリュームグループ「myvg」内の論理ボリュームのエクステントサイズは16 MiBである必要があります。
- 新しい論理ボリュームをVFATファイルシステムでフォーマットします。
- 論理ボリュームは、システム起動時に/mnt/mydataに自動的にマウントされる必要があります。
Correct Answer:
Solution:
# Check the disk layout
[root@node2 ~]# lsblk
# Partition the disk
[root@node2 ~]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.37.4).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n # Add a new partition
Partition type
p primary (1 primary, 0 extended, 3 free) # Primary partition
e extended (container for logical partitions) # Extended partition
Select (default p): p
Partition number (2-4, default 2): # Press Enter
First sector (1026048-20971519, default 1026048): # Press Enter
***Note: The partition size must be larger than the total size, it should not be exactly equal to. It is recommended to add an extra 200M.
Last sector, +/-sectors or +/-size{K,M,G,T,P} (1026048-20971519, default 20971519): +1200M # Partition size
Created a new partition 2 of type 'Linux' and of size 512 MiB.
Command (m for help): w # Save and exit
The partition table has been altered.
Syncing disks.
# Create volume group and logical volume
[root@node2 ~]# vgcreate -s 16M myvg /dev/vdb4
[root@node2 ~]# lvcreate -l 50 -n mylv myvg
# Install vfat support
[root@node2 ~]# yum provides */mkfs.vfat
[root@node2 ~]# yum -y install dosfstools
# Format the logical volume with vfat filesystem
[root@node2 ~]# mkfs.vfat /dev/myvg/mylv
# Create mount point
[root@node2 ~]# mkdir /mnt/mydata
# Update /etc/fstab for automatic mounting
[root@node2 ~]# vim /etc/fstab
/dev/myvg/mylv /mnt/mydata vfat defaults 0 0
# Mount the logical volume
[root@node2 ~]# mount -a
# Check the disk layout
[root@node2 ~]# lsblk
# Partition the disk
[root@node2 ~]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.37.4).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n # Add a new partition
Partition type
p primary (1 primary, 0 extended, 3 free) # Primary partition
e extended (container for logical partitions) # Extended partition
Select (default p): p
Partition number (2-4, default 2): # Press Enter
First sector (1026048-20971519, default 1026048): # Press Enter
***Note: The partition size must be larger than the total size, it should not be exactly equal to. It is recommended to add an extra 200M.
Last sector, +/-sectors or +/-size{K,M,G,T,P} (1026048-20971519, default 20971519): +1200M # Partition size
Created a new partition 2 of type 'Linux' and of size 512 MiB.
Command (m for help): w # Save and exit
The partition table has been altered.
Syncing disks.
# Create volume group and logical volume
[root@node2 ~]# vgcreate -s 16M myvg /dev/vdb4
[root@node2 ~]# lvcreate -l 50 -n mylv myvg
# Install vfat support
[root@node2 ~]# yum provides */mkfs.vfat
[root@node2 ~]# yum -y install dosfstools
# Format the logical volume with vfat filesystem
[root@node2 ~]# mkfs.vfat /dev/myvg/mylv
# Create mount point
[root@node2 ~]# mkdir /mnt/mydata
# Update /etc/fstab for automatic mounting
[root@node2 ~]# vim /etc/fstab
/dev/myvg/mylv /mnt/mydata vfat defaults 0 0
# Mount the logical volume
[root@node2 ~]# mount -a
ユーザーjohnのcronアクセスを拒否します。
Correct Answer:
See the solution below in Explanation.
Explanation:
Solution:
echo "john" > > /etc/cron.deny
Detailed Explanation:
* cron.deny blocks listed users from using cron.
* This is the simplest way to deny scheduled-job access for one user.
Explanation:
Solution:
echo "john" > > /etc/cron.deny
Detailed Explanation:
* cron.deny blocks listed users from using cron.
* This is the simplest way to deny scheduled-job access for one user.