016_把普通用户免秘钥加入root用户的几种方式
2018-02-13 14:58
330 查看
一、第一种方式。
(1)
[root@infra-jyallkv-tikv-pps-7 ~]# tail /etc/sudoers
## Allows members of the users group to mount and unmount the
## cdrom as root
# %users ALL=/sbin/mount /mnt/cdrom, /sbin/umount /mnt/cdrom
## Allows members of the users group to shutdown this system
# %users localhost=/sbin/shutdown -h now
## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d
%sudo ALL=NOPASSWD:ALL
(2)
[root@infra-jyallkv-tikv-pps-7 ~]# usermod -a -G sudo ansible_shell #不用从ansible_shell在其它组中移除而添加到新的sudo中
[root@infra-jyallkv-tikv-pps-7 ~]# egrep -nri "sudo" /etc/gshadow
50:sudo:!::tool.ops,ops,dev-super,dba,cideploy,ansible_shell
看到ansible_shell已经加到sudo组中了,这样su - ansible_shell中然后再执行"sudo su - root"就可以了
二、
直接在/etc/sudoers添加(未验证)
%ansible_shell ALL=NOPASSWD:ALL
(1)
[root@infra-jyallkv-tikv-pps-7 ~]# tail /etc/sudoers
## Allows members of the users group to mount and unmount the
## cdrom as root
# %users ALL=/sbin/mount /mnt/cdrom, /sbin/umount /mnt/cdrom
## Allows members of the users group to shutdown this system
# %users localhost=/sbin/shutdown -h now
## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d
%sudo ALL=NOPASSWD:ALL
(2)
[root@infra-jyallkv-tikv-pps-7 ~]# usermod -a -G sudo ansible_shell #不用从ansible_shell在其它组中移除而添加到新的sudo中
[root@infra-jyallkv-tikv-pps-7 ~]# egrep -nri "sudo" /etc/gshadow
50:sudo:!::tool.ops,ops,dev-super,dba,cideploy,ansible_shell
看到ansible_shell已经加到sudo组中了,这样su - ansible_shell中然后再执行"sudo su - root"就可以了
二、
直接在/etc/sudoers添加(未验证)
%ansible_shell ALL=NOPASSWD:ALL
相关文章推荐
- Linux普通用户下进入root方式
- ssh只允许普通用户秘钥登陆,不允许root登录
- Linux 从普通用户切换到root,两种方式的区别
- Xshell秘钥登录Linux服务器: root && 普通用户
- Linux---如何将普通用户加入root用户组
- X-shell、putty秘钥登录方式整理、普通用户密钥登录
- 普通用户su 到root,无需密码方式,及iptables封掉本机某个端口,core文件配置
- root用户 普通用户ssh信任的建立
- linux环境如何从普通用户切换到root用户
- CentOS拒绝 root 登录,改用普通用户登录
- 普通用户无法su到root用户
- eclipse中如何加入jar包以及几种加入方式的区别
- ubuntu root 或者 普通用户 的密码忘了,解决办法
- 如何解决域中普通用户只限于10台客户机加入域的数量问题
- Linux中ROOT用户删除普通用户报普通用户已登录
- 怎么让普通用户达到root用户也可以拥有权限修改文件(CentOS系统)
- 授权特定普通域用户将计算机加入域
- debian下以root用户登录方式的配置
- 使用sudo来赋予普通用户root的权限 推荐
- MVC全局用户验证的的几种方式