(1) root で /etc/sudoers ファイルを開きます。
# visudo
/etc/sudoers ファイルは、sudo コマンドで適用されるポリシーを定義します。
/etc/sudoers ファイルで、wheel 管理グループのユーザーに sudo アクセスを付与する行を見つけます。
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
110行のコメントを外します。
109 ## Same thing without a password
110 %wheel ALL=(ALL) NOPASSWD: ALL
変更を保存し、エディターを終了します。
sudo アクセスを付与するユーザーを、wheel 管理グループに追加します。
# usermod --append -G wheel ユーザ名
(2)
RedHawkユーザガイド
に従ってケーパビリティを定義します。
/etc/security/capability.confの59行目のコメントを外します。
54: ###########################################################################
55: # GROUPS
56: ###########################################################################
57:
58: # the 'wheel' group
59: group wheel admin
(3) ケーパビリティ定義ファイルに変更を加えます。
# keyf1=system-auth
# keyf2=password-auth
# cd /etc/pam.d
# cp ${keyf1} ${keyf1}-local
# cp ${keyf2} ${keyf2}-local
# echo "session required pam_capability.so" >> ${keyf1}-local
# echo "session required pam_capability.so" >> ${keyf2}-local
# ln -sf ${keyf1}-local ${keyf1}
# ln -sf ${keyf2}-local ${keyf2}
(4) 再起動してください。
(5) 確認方法
$ uname -r
6.1.157-rt57-RedHawk-9.2.10
$ id
uid=2002(redhawk) gid=2000(wheel) groups=2000(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
$ shield -r -a 1 -c
write(/proc/shield/irqs) returned 1 (Operation not permitted)
$ sudo -u redhawk shield -r -a 1 -c
CPUID irqs ltmrs procs
--------------------------------------------------
0 no no no
1 yes yes yes
2 no no no
3 no no no
4 no no no
5 no no no
6 no no no
7 no no no
8 no no no
9 no no no
10 no no no
11 no no no
12 no no no
13 no no no
14 no no no
15 no no no