Original address: https://blog.csdn.net/hlx20080808/article/details/80027254
(1) View /etc/sudoers as root user
(2) This file is a read-only file, change it to a writable state
(3) Add content to the file
[root@hlx hadoop]# vi /etc/sudoers
(4) Then change the root user file to read-only
[root@hlx hadoop]# chmod 440 /etc/sudoers
(5) Switch to ordinary users, you can use the sudo command
[root@hlx hadoop] # su hadoop
[hadoop@hlx ~ ]$ sudo shutdown - h now
Reboot OK!
[root@ltt2 bin]# su hadoop[hadoop@ltt2 bin]$ sudo shutdown
-
h now