linux 普通用户使用sudo权限

  sudo是Linux系统管理指令,是允许系统管理员让普通用户执行一些或者全部root命令的一个工具。Linux系统下,为了安全,一般来说我们操作都是在普通用户下操作,但是有时候普通用户需要使用root权限,比如在安装软件的时候。这个时候如果我们切回root用户下效率就会比较低,所以用sudo命令就会很方便。

安装sudo

yum install sudo

[root@VM_0_6_centos ~]# yum install sudo 
Loaded plugins: fastestmirror, langpacks
Repository epel is listed more than once in the configuration
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package sudo.x86_64 0:1.8.19p2-13.el7 will be updated
---> Package sudo.x86_64 0:1.8.23-4.el7_7.2 will be an update
--> Finished Dependency Resolution
……

修改权限

/etc/sudoers文件默认是只读权限,必须修改为可写,修改后可以复原回去

chmod u+w /etc/sudoers 

修改文件

给普通用户XX添加sudo权限

xx  ALL=(ALL)       ALL

 

执行

[xx@VM_0_6_centos ~]$ sudo pip3 install requests

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 xx: 

 

posted @ 2020-04-12 23:23  一只小小的寄居蟹  阅读(4626)  评论(0编辑  收藏  举报