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: 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM