linux设置sudo不要密码
linux下,普通用户,sudo时需要密码

改成没密码,
vi /etc/sudoers
在 root ALL=(ALL) ALL后加一行
sysusr ALL=(ALL) NOPASSWD: ALL (92行)
有时将用户设了nopasswd,但无效,原因是被后面的group的设置覆盖了,需要把group的设置也改为nopasswd。
sysusr账号所在组(wheel):见102行,%wheel,设置用户组sudo不加密,保存即可生效。
...
81 ## Next comes the main part: which users can run what software on
82 ## which machines (the sudoers file can be shared between multiple
83 ## systems).
84 ## Syntax:
85 ##
86 ## user MACHINE=COMMANDS
87 ##
88 ## The COMMANDS section may have other options added to it.
89 ##
90 ## Allow root to run any commands anywhere
91 root ALL=(ALL) ALL
92 sysusr ALL=(ALL) NOPASSWD: ALL
93
94 ## Allows members of the 'sys' group to run networking, software,
95 ## service management apps and more.
96 # %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS
97
98 ## Allows people in group wheel to run all commands
99 %wheel ALL=(ALL) ALL
100
101 ## Same thing without a password
102 # %wheel ALL=(ALL) NOPASSWD: ALL //这一行的#要放开,效果上,覆盖99行的设置
103
104 ## Allows members of the users group to mount and unmount the
105 ## cdrom as root
106 # %users ALL=/sbin/mount /mnt/cdrom, /sbin/umount /mnt/cdrom
107
108 ## Allows members of the users group to shutdown this system
109 # %users localhost=/sbin/shutdown -h now
110
111 ## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
112 #includedir /etc/sudoers.d
附录:查看用户所在组的两个方式:
1.groups命令
[sysusr@GCOS 12:15:58]$ groups
sysusr wheel service
<~>
2.查看/etc/group
[sysusr@GCOS 12:18:49]$ cat /etc/group|grep sysusr
wheel:x:10:sysusr
sysusr:x:1000:service,postgres,mysql,nginx,apache
service:x:2000:sysusr,postgres,mysql,nginx,apache
<~>
参考:
设置su和sudo为不需要密码
linux设置sudo不要密码的更多相关文章
- mac上设置sudo不要密码
觉得每次sudo都需要设置密码太过麻烦,于是折腾了一番,谁知走了一番弯路记录下来. 以下是网上找到的步骤 chmod u+w /etc/sudoers 给当前用户增加写权限 vi /etc/sudo ...
- Linux之sudo免密码操作
使用普通用户只需特权命令是需要输入密码,然后在五分钟以内只需命令可以免密码,下面设置免密码操作 系统环境查看 切换至root用户 sudo -i #需要输入密码 修改sudoers文件 #增加一行 y ...
- linux设置系统用户密码
目录 一:系统用户密码 1.设置用户密码 一:系统用户密码 1.设置用户密码 1.交互式方法 passwd [用户名] 2.免交互式 echo [设置密码] | passwd --stdin [用户名 ...
- Linux 设置代理时, 密码出现特殊字符怎么办?
配置代理的格式一般是这样的: $ export https_proxy=https://用户名:密码@代理地址:代理端口 比如需要配置这些: $ export http_proxy=http://Co ...
- linux 设置git记住密码
linux下: 1.在~/下, touch创建文件 .git-credentials, 用vim编辑此文件,输入: https://{username}:{password}@github.com 注 ...
- ubuntu 设置sudo 免密码
一. 修改sudoers的权限 二. 修改sudoers 文件 <1>. 在文件最后一行添加yourusername ALL=(ALL) NOPASSWD : ALL 三. 修改回sudo ...
- linux设置su和sudo为不需要密码
一 设置sudo为不需要密码 有时候我们只需要执行一条root权限的命令也要su到root,是不是有些不方便?这时可以用sudo代替.默认新建的用户不在sudo组,需要编辑/etc/sudoers ...
- linux下普通用户添加 sudo 免密码
在使用普通用户登录的时候,会经常使用sudo指令执行一些操作,有时候感觉输入密码比较繁琐,特别是需要设置一些开机启动的时候操作,而这些操作往往就需要sudo指令,如果没有免密的话,在使用普通用户登录的 ...
- Linux centosVMware MySQL常用操作设置更改root密码、连接mysql、mysql常用命令
一.设置更改root密码 启动mysql /usr/local/mysql/bin/mysql -uroot 更改环境变量PATH,增加mysql绝对路径 使mysql -uroot永久生效需要编辑, ...
随机推荐
- vue---axios实现数据交互与跨域问题
1. 通过axios实现数据请求 vue.js默认没有提供ajax功能的. 所以使用vue的时候,一般都会使用axios的插件来实现ajax与后端服务器的数据交互. 注意,axios本质上就是java ...
- 为安卓项目添加FileProvider
简单记录 android7.0开始出现FileProvider.从一个小白角度看需要注意这几点: Manifest.xml中添加provider节点 添加xml文件 模块的build.gradle中添 ...
- SpringBoot项目下的mvnw与mvnw.cmd
Maven是一个常用的构建工具,但是Maven的版本和插件的配合并不是那么完美,有时候你不得不切换到一个稍微旧一些的版本,以保证所有东西正常工作. 而Gradle提供了一个Wrapper,可以很好解决 ...
- django-用户认证模型
django本身会在mysql里存储一个user数据库 为了和django本身的user表区分 要在第一次迁移数据库前配置认证系统使用的用户模型 settings.py # django认证系统使用的 ...
- MySQL Error:Warning: (1366, "Incorrect string value: '\\xF0\\x9F\\x98\\x82\\xF0\\x9F...' for column 'xxx' at row 2")
bug现象 使用连接数据库的可视化软件插入 emoj 表情数据.生僻字,可以正常插入.(导致我一直以为跟表情没有任何关系,谷歌出来一堆跟修改数据库.表.字段 的编码的结果....)但是一启动程序插入新 ...
- 微信小程序路由带参
通过url带参传递 wxml <navigator url="../user/user?id={{item.id}}&name={{item.name}}">点 ...
- Mscordacwks.dll/SOS.dll 调试归档
找到个好东西 为什么要归档 此存档提供帮助,并可能提供对以下问题的答案 是否可以使WinDBG在符号存储中找到mscordacwks.dll?, Windbg需要不同版本的mscordacwks.dl ...
- WinDbg常用命令系列---!teb
!teb 简介 !teb扩展显示线程环境块(teb)中信息的格式化视图. 使用形式 !teb [TEB-Address] 参数 TEB-Address 要检查其TEB的线程的十六进制地址.(这不是从线 ...
- WinDbg常用命令系列---.load, .loadby (Load Extension DLL)
.load, .loadby (Load Extension DLL) 简介 .load和.loadby命令将新的扩展DLL加载到调试器中. 使用形式 .load DLLName !DLLName.l ...
- JMeter学习1
Jmeter的组织方式相对比较扁平,直接是TestPlan(相当于Project),TestPlan下创建的ThreadsGroup(相当于TestCase), Jmeter一个TestPlan也是一 ...