deian 授权用户 sudo权限
ubuntu默认用户sudo不使用密码chunli@ubuntu~$sudovim/etc/sudoers行尾追加一行,防止被其他策略覆盖chunliALL=NOPASSWD:ALL打开一个终端,试试执行sudoapt-getupdate
root@itsm-demo:~# apt-get install -y sudo
root@itsm-demo:~#vim/etc/sudoers为已经存在的user1用户授权##ThisfileMUSTbeeditedwiththe'visudo'commandasroot.##Pleaseconsideraddinglocalcontentin/etc/sudoers.d/insteadof#directlymodifyingthisfile.##Seethemanpagefordetailsonhowtowriteasudoersfile.#Defaultsenv_resetDefaultsmail_badpassDefaultssecure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"#Hostaliasspecification#Useraliasspecification#Cmndaliasspecification#UserprivilegespecificationrootALL=(ALL:ALL)ALLuser1ALL=(ALL:ALL)ALL#Allowmembersofgroupsudotoexecuteanycommand%sudoALL=(ALL:ALL)ALL#Seesudoers(5)formoreinformationon"#include"directives:#includedir/etc/sudoers.d强制保存::w!
不需要密码,直接切换到root
pi
chunli
##ThisfileMUSTbeeditedwiththe'visudo'commandasroot.##Pleaseconsideraddinglocalcontentin/etc/sudoers.d/insteadof#directlymodifyingthisfile.##Seethemanpagefordetailsonhowtowriteasudoersfile.#Defaultsenv_resetDefaultsmail_badpassDefaultssecure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"#Hostaliasspecification#Useraliasspecification#Cmndaliasspecification#UserprivilegespecificationrootALL=(ALL:ALL)ALL#Allowmembersofgroupsudotoexecuteanycommand%sudoALL=(ALL:ALL)ALL#Seesudoers(5)formoreinformationon"#include"directives:#includedir/etc/sudoers.dpiALL=(ALL)NOPASSWD:ALLchunliALL=(ALL)NOPASSWD:ALL
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。