sudo root免密码

新建了个hadoop用户,想让他sudo切换到root免密码
终端输入

nano  /etc/sudoers

ubuntu16.04是以下内容

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of 
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

它说不要直接改这个文件,要改就去改/etc/sudoers.d/的。

cd /etc/sudoers.d/
ls

看看这个目录有什么

root@ubuntu03:~# cd  /etc/sudoers.d/
root@ubuntu03:/etc/sudoers.d# ls
90-cloud-init-users  README

我这里看到有个90-cloud-init-users
nano 90-cloud-init-users打开看看
里面有个ubuntu用户已经是免密码的,在下面加上新增的hadoop用户就OK了。

# User rules for ubuntu
ubuntu ALL=(ALL) NOPASSWD:ALL
hadoop ALL=(ALL) NOPASSWD:ALL
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 137,187评论 19赞 139
  • 一、在Ubuntu下创建hadoop组和hadoop用户 增加hadoop用户组,同时在该组里增加hadoop用户...
    JeffDing阅读 496评论 0赞 1
  • 看到题目有没有一种高大上的感觉?毛线,当前是个人、是个公司都在说自己搞大数据,每天没有几个PB的数据入库,每天没有...
    丁小晶的晶小丁阅读 4,701评论 0赞 50
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 180,489评论 25赞 708
  • 三伏天,能有时间坚持雨公里跑步,实属不易。感觉跑步根本不累。出了二斤多的汗水,背心都湿了。感觉浑身气血贯通。免疫力...
    华客鲁俊阅读 260评论 0赞 1

友情链接更多精彩内容