centos、ubuntu将用户添加到sudo

1、sudo yum install 安装软件经常需要切换root用户或者sudo。

没有设置sudo报错:

xx is not in the sudoers file. This incident will be reported.

 

2、centos设置sudo

su - # 切换root

visudo # 编辑sudoers文件

找到:## Allow root to run any commands anywhere

pzhang ALL=(ALL) ALL # 添加一行,保存退出

3、ubuntu 设置sudo

sudo adduser pzhang sudo  # 添加到sudo组

posted @ 2023-09-18 15:21  我的天啊~  阅读(69)  评论(0编辑  收藏  举报