一、直接增長到wheel用戶組centos
usermod -a -G wheel username
二、編輯/etc/sudoers文件增長ui
echo "username ALL=(ALL) ALL" >> /etc/sudoers
三、本身新建一個用戶,並以組的形式增長到/etc/sudoers文件中,最後再增長另外一個用戶到這個組上spa
useradd sudogroup echo "%sudogroup ALL=(ALL) ALL" >> /etc/sudoers useradd abc usermod -aG sudogroup abc
亮點:%這個符號就是表明一個用戶組unix
參考:code