您的位置:首页 > 运维架构 > Linux

linux普通用户su 到root免密码

2017-10-17 16:50 316 查看
方法1:

运行visudo(或者vi /etc/sudoers)命令

在## Same thing without a password

# %wheel        ALL=(ALL)       NOPASSWD: ALL

下方添加一个类似的行

oracle ALL=(ALL)       NOPASSWD: ALL

方法2:

vi /etc/pam.d/su

 将 auth这一列的注释号 去除

# Uncomment the following line to implicitly trust users in the "wheel" group.

auth            sufficient      pam_wheel.so trust use_uid

然后将登陆用户加入 wheel组

usermod -G wheel oracle

方法3:

expect 脚本都可以实现,expect就是模拟手工交互的过程

例如

#!/usr/bin/expect

set password 123

spawn scp ./south_db.sql root@135.252.234.118:~

expect -nocase "password: "

send "$password\r"

expect eof
http://www.blogjava.net/jasmine214--love/archive/2010/12/28/341794.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: