linux 中如何给普通用户增加管理员权限

 

001、

使用root用户编辑配置文件:vim /etc/sudoers

在root    ALL=(ALL)       ALL行下面增加如下内容(其中liujiaxin02是普通用户名):

liujiaxin02     ALL=(ALL)       ALL

修改完成后,保存退出。

 

 

002、测试

[liujiaxin02@PC1 ~]$ whoami
liujiaxin02
[liujiaxin02@PC1 ~]$ yum install httpd
Loaded plugins: fastestmirror, langpacks
You need to be root to perform this command.
[liujiaxin02@PC1 ~]$ sudo yum install httpd     ## 普通用户使用yum
[sudo] password for liujiaxin02:
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                             | 8.3 kB  00:00:00
 * base: mirrors.bupt.edu.cn
 * epel: mirrors.bfsu.edu.cn

 

posted @ 2023-02-09 16:26  小鲨鱼2018  阅读(982)  评论(0编辑  收藏  举报