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永久生效需要编辑, ...
随机推荐
- ajax请求处理概要
/** *不关心参数传递与参数返回的形式. */ url = ctxPath + '/ccb/xxx '; $.get(url); $.post(url); /** * 常见形式. */ var ur ...
- golang执行Linux和Windows命令
1. 可接收变参命令 package main import ( "fmt" "os" "os/exec" "strings&qu ...
- window安装gcc、g++、make等编译环境
1. MinGW官网下载:http://www.mingw.org 点击右上角Downloads 点击下载 mingw-get-setup.exe 2. 百度网盘(2019年4月从官网下 ...
- 安恒西湖论剑线下上午CTF部分题目WP
简单的做了两个题,一道逆向,一道misc,其他题目,因为博主上课,时间不太够,复现时间也只有一天,后面的会慢慢补上 先说RE1,一道很简单的win32逆向,跟踪主函数,R或者TAB按几下, 根据esp ...
- redis启动异常处理一例
rm -rf /var/log/redis/redis.log echo "net.core.somaxconn= 1024" >> /etc/sysctl.conf ...
- 使用Arduino开发板和ESP8266从互联网读取数据
ESP8266-01是一款很强大的模块,可以满足我们任何IOT项目的需求.自发布以来,它已经形成了一个很强大的群体,并演变成一个易于使用.价格低廉且功能强大的Wi-Fi模块.另一个更受欢迎的开源平台是 ...
- 关于立即调用的函数表达式(IIFE)
在 JavaScript 中,圆括号 () 是一种运算符,跟在函数名之后,表示调用该函数.比如,print() 就表示调用 print 函数 有时,我们需要在定义函数之后,立即调用该函数,例如: fu ...
- 从url中下载资源(目前测试只有照片,文件类的没有进行测试)
首先:是工具类: public class DownLoadUtils { /** * 从网络Url中下载文件 * * @param urlStr url路径 * @param fileName 文件 ...
- 通过ip找mac
# coding:utf-8 import os cmd = {'arp': 'arp -a | find "', 'route': 'route PRINT ' } def win_mac ...
- web自动化测试-自动化测试模型介绍
一.线性测试 什么是线性测试? 通过录制或编写对应用程序的操作步骤产生相应的线性脚本,每个测试脚本相对独立,不产生依赖和调用,单纯的来模拟用户完整的操作场景 缺点 1.开发成本高,测试用例之间存在重复 ...