我今天问了一个类似的问题,关于如何将我的服务器用户authentication到postgres数据库,而不是/etc/passwd文件或LDAP,我在那里得到了一些有用的答案。 我发现我有三件服务器authentication需要处理:login用户,设置他们的用户名和gid,并在必要时给他们sudo访问权限。 我能够findpostgres的NSS和PAM模块,但没有关于如何使用数据库,尤其是postgres, sudo而不是sudoers和sudoers sudoers.d 。 我试图为sudofind一个插件,但它看起来并不存在 – 我只在sudo网站插件页面上find了一个插件。 有没有可能使用外部数据库的sudo ?
我读了所有sudo文章serverfault,但我仍然无法弄清楚我做错了什么。 通常我终于find解决办法,但不是这次: 我希望apache用户能够以用户“hremotessh”执行这个命令: sudo /home/hremotessh/scripts/redirect.sh 8892 8893 所以我加了visudo: apache ALL=(hremotessh) NOPASSWD: /home/hremotessh/scripts/redirect.sh 但sudo仍然要求密码? sudo /home/hremotessh/scripts/redirect.sh [sudo] password for apache: 我尝试过,但不是更好: sudo -u hremotessh /home/hremotessh/scripts/redirect.sh hremotessh is not in the sudoers file. This incident will be reported. 任何想法将受到热烈欢迎:-) 丹尼斯
在CentOS 6.5中,我会为用户设置sudo, useradd -G wheel -c“John Smith”jsmith visudo命令 取消注释此行 – %wheel ALL =(ALL)ALL usermod -G wheel -a jsmith 重启sshd – /etc/init.d/sshd restart sshlogin为jsmith并input“sudo bash” 当我在CentOS 7中尝试相同的东西时,我在/ var / log / secure中看到以下内容 – Oct 8 05:20:00 localhost sudo: jsmith : user NOT in sudoers ; TTY=pts/1 ; PWD=/home/jsmith ; USER=root ; COMMAND=/bin/bash 这个程序不再适用于CentOS-7吗? 更多信息 – 文件/ […]
我正在使用CentOS 6并尝试使用以下命令在Apache中调用sudo: exec("sudo -u kouser whoami 2>&1",$output,$code); 但是SElinux添加一行来输出 array(2) { [0]=> string(53) "sudo: unable to send audit message: Permission denied" [1]=> string(61) "kouser" } 当我停止SElinux这条线将隐藏。 tail / var / log / secure Mar 1 10:11:44 ERP-Server sudo: apache : TTY=unknown ; PWD=/var/www/html/test ; USER=kouser ; COMMAND=/usr/bin/whoami Mar 1 10:11:44 ERP-Server sudo: PAM audit_log_acct_message() failed: Permission […]
我的networking上有一个Windows用户,他们有Samba访问我们的Linux开发服务器。 有时候,权限或所有权会因为未知的原因而变得混乱,他将不能再编辑文件。 为了解决这个问题,我给了他通过PuTTY和sudoers文件( sudo visudo )的访问权限,我添加了这样一行: username ALL = /bin/chmod, /bin/chown 现在显然,他现在可以把所有东西都放在自己身上,并删除整个驱动器。 他是值得信赖的,但是我担心是否有人妥协了他的账户,或者他不小心钻出了他的账户。 有没有办法限制他的帐户,所以只能在/home/username和/specified/directory下chmod或chown ? 我在服务器上运行Ubuntu 10.10。
我有sudo设置为用户(myuser)如下“主机名”(sudoers内容): Cmnd_Alias SCRIPT = /path/脚本* myuser ALL =(suser)NOPASSWD:SCRIPT 这工作正常,所以我可以运行以下,作为主机名myuser本地login,无需密码: sudo -u suser / path /脚本 但是,当我使用ssh(带密钥设置,所以不需要密码)login和运行,如下所示: ssh主机名sudo -u suser / path /脚本 我得到提示input密码,当input密码时,我得到: 对不起,用户myuser不能像主机名上的suser那样执行'/ path / script' 。 更新问题是通过从sudoers命令的末尾删除“*”来解决的。 *被添加到允许parameter passing给脚本,但实际上并不需要。 仍然不明白为什么*允许sudo在本地工作,但不能通过SSH。 所以问题依然存在
我有一个PHP脚本调用这样的bash脚本: <?php $result = exec('sudo /bin/bash /var/www/my_bash_script.sh /var/www/vhosts/testsite/htdocs/'); var_dump($result); ?> 这是my_bash_script.sh的内容: #!/bin/bash svn export –force –no-auth-cache –username myusername –password mypassword http://1.2.3.4/repos/path/to/repo/ $1 2>&1 find $1 -print0 -type d | xargs -0 -n 1 -0 chown -R -v root:root 2>&1 find $1'storage' -print0 -type d | xargs -0 -n 1 chown -R -v apache 2>&1 find […]
为了安全起见,我正在pipe理一个CentOS 4.7服务器。 但有时候我需要一个用户shell来安装。 获取loginshell的最佳方式是什么? 刚才我用 sudo –u <user> bash –rcfile /home/<user>/.bash_profile 但这并不完美。 许多环境variables不是intitialized。 埃里希
如何为用户提供sudo访问权限,但限制他们只能编辑文件,并且只能指定在指定目录下的文件。 例如,我希望用户abc能够编辑/var/www/vhosts/hostabc/及其子项中的所有文件。
我正在努力运行以下命令: ssh someuser@lab-test "sudo /usr/local/scripts/user.sh add tstt7777 177700007 \"Test User 06\" " 长话短说我需要以远程机器的某些用户身份运行ROOT专用的user.sh脚本。 但是,我不希望某个用户能够运行任何其他命令,打开一个shell或以其他方式访问系统。 用户只需要用多个dynamic参数运行该脚本。 我已经处理了公共密钥交换,并且在sudo中添加了专用信息: #Sudo someuser ALL = NOPASSWD: /usr/local/scripts/user.sh 但是我得到以下错误: sudo: sorry, you must have a tty to run sudo 我已经在ssh中查看了“Command =”函数,但是我的理解是,这只会运行指定的命令,并且不允许参数在我的调用中指示。 有什么我失踪,使我的方法通过sudo工作? 有没有更好的方法,我没有考虑SSH或BASH?