centos 新增用户并添加到sudoers

版权声明:本文为博主原创文章,转载请附带本文链接 https://blog.csdn.net/qq_37933685/article/details/82047706

centos linux新增用户并添加到sudoer

#创建一个普通用户suveng
useradd suveng
#为hadoop用户添加密码:
echo 123456 | passwd --stdin suveng
#将bigdata添加到sudoers
echo "suveng ALL = (root) NOPASSWD:ALL" | tee /etc/sudoers.d/suveng
chmod 0440 /etc/sudoers.d/suveng
#解决sudo: sorry, you must have a tty to run sudo问题,在/etc/sudoer注释掉 Default requiretty 一行
sudo sed -i 's/Defaults    requiretty/Defaults:suveng !requiretty/' /etc/sudoers

猜你喜欢

转载自blog.csdn.net/qq_37933685/article/details/82047706