加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 创建组以在CentOS中重新启动服务

发布时间:2020-12-14 02:57:08 所属栏目:Linux 来源:网络整理
导读:SYSTEM:CentOS 6.2版(最终版) 我试图只允许某个组的用户让它调用websupport访问重启2服务:mysqld和httpd 编辑:我不想给这些用户sudo访问权限 我已将这些行添加到/ etc / sudoers: %websupport ALL = NOPASSWD:/etc/init.d/httpd 和 %websupport ALL =
SYSTEM:CentOS 6.2版(最终版)

我试图只允许某个组的用户让它调用websupport访问重启2服务:mysqld和httpd

编辑:我不想给这些用户sudo访问权限

我已将这些行添加到/ etc / sudoers:

%websupport ALL = NOPASSWD:/etc/init.d/httpd

%websupport ALL = NOPASSWD:/etc/init.d/mysqld

以用户身份登录并尝试运行时:

/etc/init.d/httpd restart

我得到这个结果:

rm: cannot remove ‘/var/run/httpd/httpd.pid’: Permission Denied [FAILED]
rm: cannot remove ‘/var/lock/subsys/httpd’ : Permission Denied
rm: cannot remove ‘/var/run/httpd/httpd.pid’ : Permission Denied
Starting httpd: httpd: apr_sockaddr_info_get() failed for wssapache
httpd: Could not reliably determine the server’s fully qualified domain name,using 127.0.0.1 for ServerName
(13)Permission denied: make_sock: could not bind to address [::]:80
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available,shutting down
Unable to open logs [FAILED]

试图运行时:

/etc/init.d/mysqld restart

我得到这个结果:

cat: /var/run/mysqld/mysqld.pid: Permission denied
Stopping mysqld: [FAILED]
Starting mysqld: [ OK ]

解决方法

您的sudoers中的条目看起来不错.您需要使用sudo来运行命令,例如
sudo etc/init.d/httpd restart

sudo etc/init.d/mysqld restart

您也可以组合sudoers中的条目

%websupport ALL=NOPASSWD:/etc/init.d/mysqld,/etc/init.d/httpd

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读