本篇文章給大家分享的是有關(guān)如何進(jìn)行l(wèi)inux sudo權(quán)限配置,小編覺得挺實用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。
這里記錄一下linux的sudo簡單配置過程,備后查。
1、root打開sudo配置文件
[root@centos ~]# visudo
2、sudo配置項
## 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
mysql ALL=(ALL) ALL #配置mysql用戶等同root用戶執(zhí)行的所有命令
3、配置mysql免密執(zhí)行
## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d
mysql localhost=(root) NOPASSWD:ALL
4、root修改mysql的密碼
[root@centos ~]# passwd mysql
5、mysql添加mysql用戶的sudo密碼,sudo密碼是第4部設(shè)置的mysql操作系統(tǒng)層的密碼
-bash-4.1$ sudo uname
[sudo] password for mysql:
Linux
-bash-4.1$
6、查看sudo配置
[root@centos ~]# sudo -l
Matching Defaults entries for root on this host:
requiretty, !visiblepw, always_set_home, env_reset, env_keep="COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR LS_COLORS",
env_keep+="MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE", env_keep+="LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT
LC_MESSAGES", env_keep+="LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE", env_keep+="LC_TIME LC_ALL LANGUAGE LINGUAS
_XKB_CHARSET XAUTHORITY", secure_path=/sbin\:/bin\:/usr/sbin\:/usr/bin
User root may run the following commands on this host:
(ALL) ALL
[root@centos ~]#
7、mysql用戶測試sudo是否正確
-bash-4.1$ sudo mkdir /test1
-bash-4.1$ ls -l /test1
total 0
-bash-4.1$ rm -rf /test1
rm: cannot remove `/test1': Permission denied
-bash-4.1$ sudo rm -rf /test1
-bash-4.1$ ls -l /test1
ls: cannot access /test1: No such file or directory
-bash-4.1$
linux的sudo配置完成!
以上就是如何進(jìn)行l(wèi)inux sudo權(quán)限配置,小編相信有部分知識點可能是我們?nèi)粘9ぷ鲿姷交蛴玫降?。希望你能通過這篇文章學(xué)到更多知識。更多詳情敬請關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道。
本文名稱:如何進(jìn)行l(wèi)inuxsudo權(quán)限配置-創(chuàng)新互聯(lián)
轉(zhuǎn)載來于:http://www.rwnh.cn/article44/doedee.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供關(guān)鍵詞優(yōu)化、外貿(mào)網(wǎng)站建設(shè)、服務(wù)器托管、網(wǎng)站制作、全網(wǎng)營銷推廣、網(wǎng)站排名
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容