ルートユーザーだけがシステムを停止/再起動する権限を持っているかどうかを確認するには?

ルートユーザーだけがシステムを停止/再起動する権限を持っているかどうかを確認するには?

CentOS Linuxは、デフォルトですべてのユーザーに、およびhaltコマンドを使用してシステムを「停止」および「再起動」する権限を許可しますreboot

haltrootman / rebootsystemの権限を持つようにシステムを設定するにはどうすればよいですか?

ベストアンサー1

CentOS/RHEL/Fedora

次のコマンドのエントリを削除して、そのコマンドへのアクセスを無効にできます/etc/security/console.apps/*

$ $ ls /etc/security/console.apps/
authconfig      gparted          poweroff                      system-config-date      system-config-network-cmd  zenmap-root
authconfig-gtk  halt             reboot                        system-config-keyboard  system-config-selinux
authconfig-tui  kismet_capture   setup                         system-config-language  system-config-users
chkrootkit      liveusb-creator  system-config-authentication  system-config-lvm       wifi-radar
config-util     lshw-gui         system-config-boot            system-config-network   wireshark

$ rm -f /etc/security/console.apps/reboot

上記はここで見つけることができます。27.2。コンソールプログラムアクセスを無効にする - CentOS展開ガイド

亀裂方法

次のようにすればこれを達成できると思います。ディレクトリには/lib/upstart次のコマンドがあります。

$ pwd
/lib/upstart

$ ls -la
total 176
drwxr-xr-x.  2 root root  4096 Sep  9  2011 .
dr-xr-xr-x. 16 root root 12288 May  4 21:27 ..
lrwxrwxrwx   1 root root     6 May 26  2011 halt -> reboot
lrwxrwxrwx   1 root root     6 May 26  2011 poweroff -> reboot
-rwxr-xr-x   1 root root 17112 May 11  2011 reboot
-rwxr-xr-x   1 root root 14472 May 11  2011 runlevel
-rwxr-xr-x   1 root root 65976 May 11  2011 shutdown
-rwxr-xr-x   1 root root 56304 May 11  2011 telinit

実行可能ファイルを再起動するには、chmod 700を使用してください。

$ chmod 700 /lib/upstart/reboot

おすすめ記事