pkexec bash

通过如上命令,可以进入root模式,然后恢复sudoers。前提是root账户没被禁用。

precise (1) pkexec.1.gz

Provided by: policykit-1_0.104-1_i386

NAME

       pkexec - Execute a command as another user

SYNOPSIS

       pkexec [--version] [--disable-internal-agent] [--help]

       pkexec [--user username] PROGRAM [ARGUMENTS...]

DESCRIPTION

       pkexec allows an authorized user to execute PROGRAM as another user. If
username is not specified, then the program will be executed as the
administrative super user, root.

RETURN VALUE

       Upon successful completion, the return value is the return value of
PROGRAM. If the calling process is not authorized or an authorization
could not be obtained through authentication or an error occured,
pkexec exits with a return value of 127. If the authorization could not
be obtained because the user dismissed the authentication dialog,
pkexec exits with a return value of 126.

AUTHENTICATION AGENT

       pkexec, like any other PolicyKit application, will use the
authentication agent registered for the calling process. However, if no
authentication agent is available, then pkexec will register its own
textual authentication agent. This behavior can be turned off by
passing the --disable-internal-agent option.

SECURITY NOTES

       Executing a program as another user is a privileged operation. By
default the required authorization (See the section called "REQUIRED
AUTHORIZATIONS") requires administrator authentication. In addition,
the authentication dialog presented to the user will display the full
path to the program to be executed so the user is aware of what will
happen: [IMAGE][1] +----------------------------------------------------------+
| Authenticate [X] |
+----------------------------------------------------------+
| |
| [Icon] Authentication is needed to run `/bin/bash' |
| as the super user |
| |
| An application is attempting to perform an |
| action that requires privileges. Authentication |
| as the super user is required to perform this |
| action. |
| |
| Password for root: [_________________________] |
| |
| [V] Details: |
| Command: /bin/bash |
| Run As: Super User (root) |
| Action: org.freedesktop.policykit.exec |
| Vendor: The PolicyKit Project |
| |
| [Cancel] [Authenticate] |
+----------------------------------------------------------+ The environment that PROGRAM will run it, will be set to a minimal
known and safe environment in order to avoid injecting code through
LD_LIBRARY_PATH or similar mechanisms. In addition the PKEXEC_UID
environment variable is set to the user id of the process invoking
pkexec. As a result, pkexec will not allow you to run X11 applications
as another user since the $DISPLAY and $XAUTHORITY environment
variables are not set. These two variables will be retained if the
org.freedesktop.policykit.exec.allow_gui annotation on an action is set
to a nonempty value; this is discouraged, though, and should only be
used for legacy programs.

REQUIRED AUTHORIZATIONS

       By default, the org.freedesktop.policykit.exec authorization is
required unless an action definition file is present for the program in
question. To require another authorization, it can be specified using
the org.freedesktop.policykit.exec.path annotation on an action (See
the section called "EXAMPLE" for details).

EXAMPLE

       To specify what kind of authorization is needed to execute the program
/usr/bin/pk-example-frobnicate as another user, simply write an action
definition file like this <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig> <vendor>Examples for the PolicyKit Project</vendor>
<vendor_url>http://hal.freedesktop.org/docs/PolicyKit/</vendor_url> <action id="org.freedesktop.policykit.example.pkexec.run-frobnicate">
<description>Run the PolicyKit example program Frobnicate</description>
<description xml:lang="da">Kor PolicyKit eksemplet Frobnicate</description>
<message>Authentication is required to run the PolicyKit example program Frobnicate (user=$(user), program=$(program), command_line=$(command_line))</message>
<message xml:lang="da">Autorisering er pakraevet for at afvikle PolicyKit eksemplet Frobnicate (user=$(user), program=$(program), command_line=$(command_line))</message>
<icon_name>audio-x-generic</icon_name>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_self_keep</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/pk-example-frobnicate</annotate>
</action> </policyconfig> and drop it in the /usr/share/polkit-1/actions directory under a
suitable name (e.g. matching the namespace of the action). Note that in
addition to specifying the program, the authentication message,
description, icon and defaults can be specified. Note that occurences
of the strings $(user), $(program) and $(command_line) in the message
will be replaced with respectively the user (of the form "Real Name
(username)" or just "username" if there is no real name for the
username), the binary to execute (a fully-qualified path, e.g.
"/usr/bin/pk-example-frobnicate") and the command-line, e.g.
"pk-example-frobnicate foo bar". For example, for the action defined
above, the following authentication dialog will be shown: [IMAGE][2] +----------------------------------------------------------+
| Authenticate [X] |
+----------------------------------------------------------+
| |
| [Icon] Authentication is required to run the PolicyKit |
| example program Frobnicate |
| |
| An application is attempting to perform an |
| action that requires privileges. Authentication |
| is required to perform this action. |
| |
| Password: [__________________________________] |
| |
| [V] Details: |
| Command: /usr/bin/pk-example-frobnicate |
| Run As: Super User (root) |
| Action: org.fd.pk.example.pkexec.run-frobnicate |
| Vendor: Examples for the PolicyKit Project |
| |
| [Cancel] [Authenticate] |
+----------------------------------------------------------+ If the user is using the da_DK locale, the dialog looks like this: [IMAGE][3] +----------------------------------------------------------+
| Autorisering [X] |
+----------------------------------------------------------+
| |
| [Icon] Autorisering er pakraevet for at afvikle |
| PolicyKit eksemplet Frobnicate |
| |
| Et program forsoger at udfore en handling der |
| kraever privilegier. Autorisering er pakraevet. |
| |
| Kodeord: [___________________________________] |
| |
| [V] Detaljer: |
| Bruger: Super User (root) |
| Program: /usr/bin/pk-example-frobnicate |
| Handling: org.fd.pk.example.pkexec.run-frobnicate |
| Vendor: Examples for the PolicyKit Project |
| |
| [Annuller] [Autorisering] |
+----------------------------------------------------------+ Note that pkexec does no validation of the ARGUMENTS passed to PROGRAM.
In the normal case (where administrator authentication is required
every time pkexec is used), this is not a problem since if the user is
an administrator he might as well just run pkexec bash to get root. However, if an action is used for which the user can retain
authorization (or if the user is implicitly authorized), such as with
pk-example-frobnicate above, this could be a security hole. Therefore,
as a rule of thumb, programs for which the default required
authorization is changed, should never implicitly trust user input
(e.g. like any other well-written suid program).

AUTHOR

       Written by David Zeuthen davidz@redhat.com with a lot of help from many
others.

BUGS

       Please send bug reports to either the distribution or the polkit-devel
mailing list, see the link
http://lists.freedesktop.org/mailman/listinfo/polkit-devel on how to
subscribe.

SEE ALSO

       polkit(8), pkaction(1), pkcheck(1)

NOTES

        1. /usr/share/gtk-doc/html/polkit-1/pkexec-bash.png

        2. /usr/share/gtk-doc/html/polkit-1/pkexec-frobnicate.png

        3. /usr/share/gtk-doc/html/polkit-1/pkexec-frobnicate-da.png

ubuntu sudoers改坏了。的更多相关文章

  1. 【转载】sudoers改坏后无法使用sudo的解决办法

    练习安装odoo的时候,创建了一个odoo用户,想把它赋予sudo权限,然而,编辑的时候不留意,改坏了,导致sudo无法使用,无法编辑sudoers文件修改回来. 提示如下信息: >>&g ...

  2. Ubuntu改坏sudoers后无法使用sudo的解决办法

    练习安装odoo的时候,创建了一个odoo用户,想把它赋予sudo权限,然而,编辑的时候不留意,改坏了,导致sudo无法使用,无法编辑sudoers文件修改回来. 总提示如下信息: >>& ...

  3. /etc/profile文件被改坏导致命令不可用

    这几天在装一个软件,设置环境变量的时候,不小心把/etc/profile文件改坏了(就是没配置对),在source /etc/profile后导致所有命令都不可用了.出现如下报错: -bash: xx ...

  4. Ubuntu 误改/etc/sudoers 文件权限

    添加用户时不小心修改了/etc/sudoers 权限,结果不能sudo了,Ubuntu默认关闭root帐户,结果傻X了,无法改回了. 方法如下: 1.重启机器,开机按ESC,进入恢复模式 2.此时,磁 ...

  5. ubuntu 乱码 改为英文

    http://878045653.blog.51cto.com/2693110/735654 解决方法: 改成全英文环境来解决 方格 乱码 : 用vim配置语言环境变量 vim / etc/envir ...

  6. 阿里云ECS服务器将默认的Ubuntu系统改成桌面版

    以Ubuntu14.04 64位 为例 1.用自己PC登录阿里云,停止正在运行的实例 2.重装系统 更换系统盘->选择"公共镜像".Ubuntu. Ubuntu14.04 6 ...

  7. ubuntu sudoers配置错误

    ubuntu16 sudoers配置错误,普通用户无法使用sudo了,且root帐户也没启动. 重启,按住esc,选择恢复模式,选择root模式 mount -o remount rw / 修改文件至 ...

  8. ubuntu命令改变文档权限和所有者

    chgrp :改变档案所属群组 chown :改变档案拥有者 chmod :改变档案的权限, SUID, SGID, SBIT等等的特性,可读.可写.可执行 1 chgrp 例子 chgrp [-R] ...

  9. 转载 - Ubuntu源改国内源 与 批量更改ubuntu机器apt源

    change_apt_source.sh # !/bin/bash # 备份原来的源文件 cp /etc/apt/sources.list /etc/apt/sources.list.bak # 获取 ...

随机推荐

  1. 第145天:jQuery.touchSlider触屏满屏左右滚动幻灯片

    1.HTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www. ...

  2. hdu mophues

    在比赛的时候,被这个题目虐死了,这一周中每当我有空闲时间我就总是思索这个题目的解题方法. 终于在自己学过了mobius反演,并且看过别人写得解题思路后自己有了思路. 下面说说我的解题思路吧. 首先题目 ...

  3. 迭代器 每迭代一次 指针往下面移动一次 除非JVM回收了内存 否则 他的指针不会回到原地

    迭代器 每迭代一次 指针往下面移动一次 除非JVM回收了内存 否则 他的指针不会回到原地

  4. zookeeper应用实例

    创建持久节点和临时节点 ZooKeeper zk=new ZooKeeper(HOST,CLIENT_SESSION_TIMEOUT,new Watcher(){ @Override public v ...

  5. 利用JavaFX访问MySQL数据库

    1. 创建数据库表 create table Course( courseId char(5), subjectId char(4) not null, courseNumber integer, t ...

  6. Contest 1

    A:注意到模数是要求lcm的数的倍数,直接先取模就可以了.考场脑抽,对其质因数分解判了一下每个因子有没有,当然也行. #include<iostream> #include<cstd ...

  7. [BZOJ3166][Heoi2013]Alo 可持久化Trie树

    3166: [Heoi2013]Alo Time Limit: 20 Sec Memory Limit: 256 MB DescriptionWelcome to ALO ( Arithmetic a ...

  8. 【BZOJ4198】【NOI2015】荷马史诗(贪心,Huffman树)

    [BZOJ4198][NOI2015]荷马史诗(贪心,Huffman树) 题面 BZOJ 洛谷 题解 合并果子都是不知道多久以前做过的了.现在才知道原来本质就是一棵哈夫曼树啊. 这题我们仔细研究一下题 ...

  9. Linux内核分析第六周学习笔记——分析Linux内核创建一个新进程的过程

    Linux内核分析第六周学习笔记--分析Linux内核创建一个新进程的过程 zl + <Linux内核分析>MOOC课程http://mooc.study.163.com/course/U ...

  10. 第13章 MySQL服务器的状态--高性能MySQL学习笔记

    13.1 系统变量 -- 服务器配置变量 MySQL通过SHOW VARIABLES  SQL命令显示许多系统变量. 13.2 状态变量--SHOW STATUS SHOW STATUS 命令会在一个 ...