问题描述:

使用普通账号test通过systemctl启动系统服务提示需要输入root密码:

解决方案:

根据上面提示得知权限由polkit进行管理,对应的是org.freedesktop.systemd1.policy这个配置文件下的manae-units动作

进入/usr/share/polkit-1/actions/org.freedesktop.systemd1.policy,将对应manae-units的defaults中的授权全部改为yes,然后执行systemctl restart polkit重启polkit

        <action id="org.freedesktop.systemd1.manage-units">
....................
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>

下图为权限可选的配置参数:

defaults 选项

This element is used to specify implicit authorizations for clients. Elements that can be used inside defaults include:

  • allow_any: Implicit authorizations that apply to any client. Optional.

  • allow_inactive: Implicit authorizations that apply to clients in inactive sessions on local consoles. Optional.

  • allow_active: Implicit authorizations that apply to clients in active sessions on local consoles. Optional.

Each of the allow_any, allow_inactive and allow_active elements can contain the following values:

  • no: Not authorized.

  • yes: Authorized.

  • auth_self: Authentication by the owner of the session that the client originates from is required. Note that this is not restrictive enough for most uses on multi-user systems; auth_admin* is generally recommended.

  • auth_admin: Authentication by an administrative user is required.

  • auth_self_keep: Like auth_self but the authorization is kept for a brief period (e.g. five minutes). The warning about auth_self above applies likewise.

  • auth_admin_keep: Like auth_admin but the authorization is kept for a brief period (e.g. five minutes).

CentOS7下普通账号通过systemctl管理服务需要输入root密码问题的更多相关文章

  1. Linux_CentOS 中systemctl 管理服务、防火墙 firewalld 以及 SELinux 配置

    使用 systemctl 管理服务 systemctl 就是 service 和 chkconfig 这两个命令的整合,在 CentOS 7 就开始被使用了,systemctl是系统服务管理器命令,它 ...

  2. 二进制编译安装nginx并加入systemctl管理服务

    一.安装nginx所需环境 # yum install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel -y 二.安装ngi ...

  3. Linux学习-透过 systemctl 管理服务

    透过 systemctl 管理单一服务 (service unit) 的启动/开机启动与观察状态 一般来说,服务的启动有两个阶段,一 个是『开机的时候设定要不要启动这个服务』, 以及『你现在要不要启动 ...

  4. RHEL7使用systemctl管理服务

    1.   systemctl命令 说明 systemctl    start   [unit type] 启动服务 systemctl    stop   [unit type] 停止服务 syste ...

  5. centos7备份还原与grub2引导和rescue模式修改root密码

    一.centos7备份1.su -2.cd /3.tar -zpPcvf backup.tgz --exclude=/sys --exclude=/mnt --exclude=/proc --excl ...

  6. 使用 Centos 7 的 systemctl 管理服务

    CentOS 7的服务systemctl脚本存放在:/usr/lib/systemd/,有系统(system)和用户(user)之分,像需要开机不登陆就能运行的程序,存系统服务里即:/usr/lib/ ...

  7. 使用systemctl管理服务

    系统服务,开机不需要登录就能运行的程序(相当于开机自启)/usr/lib/systemd/system 用户服务,需要登录后才能运行的程序/usr/lib/systemd/user 目录下又存在两种类 ...

  8. centos7下docker发布第一个微服务应用(Eureka)

    1.在windows下打包 微服务应用通过maven进行打包,在项目的pom.xml执行mvn clean package,或者直接通过idea或者eclipse进行maven打包 之上操作将在项目的 ...

  9. 在centos7下用http搭建配置svn服务

    应用场景:SVN是Subversion的简称,是一个开放源代码的版本控制系统. 安装环境:centos7  //已关闭 Selinux和 Firewall 配置步骤: 1. 安装HTTP和SVN相关软 ...

随机推荐

  1. Java实现分割矩形

    给定平面内平行于坐标轴的一个矩形,从矩形内选 择一些点,从这些点向右和向上各射出一条射线, 请问:这些射线将矩形分成了多少份. 数据格式: 输入的第一行包含两个整数x, y,表示矩形是由(0, 0), ...

  2. C#Winform中resx文件无效 找不到路径

    问题由来 笔者因为更改了添加的图片的路径,再把路径改成图片所在的路径还是报resx文件无效,未能找到路径 问题原因 其实这个问题是因为对对象的引用修改了,但是resx文件中的应用还是没有修改.因为re ...

  3. 【Jquery】判断宽度跳转

    $(window).resize(function(){ var wWidth = screen.width; if( wWidth < 788 ){ window.location.href= ...

  4. 第一章01-正常情况下Activity的生命周期

    一.Android下能见到的界面 Window Dialog Toast Activity 二.Activity的生命周期分析 典型情况下的生命周期 ​是指在有用户参与的情况下,Activity所经过 ...

  5. 青蛙的约会 (ax+by=c求最小整数解)【拓展欧几里得】

                                                  青蛙的约会(点击跳转) 两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面.它们很高兴地发现它们住 ...

  6. 『图论』LCA 最近公共祖先

    概述篇 LCA (Least Common Ancestors) ,即最近公共祖先,是指这样的一个问题:在一棵有根树中,找出某两个节点 u 和 v 最近的公共祖先. LCA 可分为在线算法与离线算法 ...

  7. 【大厂面试08期】谈一谈你对HashMap的理解?

    摘要 HashMap的原理也是大厂面试中经常会涉及的问题,同时也是工作中常用到的Java容器,本文主要通过对以下问题进行分析讲解,来帮助大家理解HashMap的原理. 1.HashMap添加一个键值对 ...

  8. 一时技痒,撸了个动态线程池,源码放Github了

    阐述背景 线程池在日常工作中用的还挺多,当需要异步,批量处理一些任务的时候我们会定义一个线程池来处理. 在使用线程池的过程中有一些问题,下面简单介绍下之前遇到的一些问题. 场景一:实现一些批量处理数据 ...

  9. 记录一次Flink作业异常的排查过程

    最近2周开始接手apache flink全链路监控数据的作业,包括指标统计,业务规则匹配等逻辑,计算结果实时写入elasticsearch. 昨天遇到生产环境有作业无法正常重启的问题,我负责对这个问题 ...

  10. 记linux vsftpd配置遇到的错误

    环境:centos 7 yum安装 yum install -y vsftpd 增加用户 # 家目录为/www 并设置nologin useradd -d /www -s /sbin/nologin ...