【就业班作业】【第十一周】2、配置magedu用户的sudo权限,允许magedu用户拥有root权限

配置magedu用户的sudo权限,允许magedu用户拥有root权限

[root@lab-CentOS-6 ~]# useradd magedu
[root@lab-CentOS-6 ~]# passwd magedu
Changing password for user magedu.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@lab-CentOS-6 ~]# 
[root@lab-CentOS-6 ~]#
[root@lab-CentOS-6 ~]# visudo
## Next comes the main part: which users can run what software on
## which machines (the sudoers file can be shared between multiple
## systems).
## Syntax:
##
##      user    MACHINE=COMMANDS
##
## The COMMANDS section may have other options added to it.
##
## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
magedu  ALL=(root)      ALL
[root@lab-CentOS-6 ~]# su magedu
[magedu@lab-CentOS-6 root]$ sudo fdisk /dev/sda

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for magedu: 

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): q

[magedu@lab-CentOS-6 root]$ 

(结束)

posted @ 2020-10-16 15:01  sankeya  阅读(112)  评论(0编辑  收藏  举报