ubuntu sudoers改坏了。
pkexec bash
通过如上命令,可以进入root模式,然后恢复sudoers。前提是root账户没被禁用。
precise (1) pkexec.1.gz
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改坏了。的更多相关文章
- 【转载】sudoers改坏后无法使用sudo的解决办法
练习安装odoo的时候,创建了一个odoo用户,想把它赋予sudo权限,然而,编辑的时候不留意,改坏了,导致sudo无法使用,无法编辑sudoers文件修改回来. 提示如下信息: >>&g ...
- Ubuntu改坏sudoers后无法使用sudo的解决办法
练习安装odoo的时候,创建了一个odoo用户,想把它赋予sudo权限,然而,编辑的时候不留意,改坏了,导致sudo无法使用,无法编辑sudoers文件修改回来. 总提示如下信息: >>& ...
- /etc/profile文件被改坏导致命令不可用
这几天在装一个软件,设置环境变量的时候,不小心把/etc/profile文件改坏了(就是没配置对),在source /etc/profile后导致所有命令都不可用了.出现如下报错: -bash: xx ...
- Ubuntu 误改/etc/sudoers 文件权限
添加用户时不小心修改了/etc/sudoers 权限,结果不能sudo了,Ubuntu默认关闭root帐户,结果傻X了,无法改回了. 方法如下: 1.重启机器,开机按ESC,进入恢复模式 2.此时,磁 ...
- ubuntu 乱码 改为英文
http://878045653.blog.51cto.com/2693110/735654 解决方法: 改成全英文环境来解决 方格 乱码 : 用vim配置语言环境变量 vim / etc/envir ...
- 阿里云ECS服务器将默认的Ubuntu系统改成桌面版
以Ubuntu14.04 64位 为例 1.用自己PC登录阿里云,停止正在运行的实例 2.重装系统 更换系统盘->选择"公共镜像".Ubuntu. Ubuntu14.04 6 ...
- ubuntu sudoers配置错误
ubuntu16 sudoers配置错误,普通用户无法使用sudo了,且root帐户也没启动. 重启,按住esc,选择恢复模式,选择root模式 mount -o remount rw / 修改文件至 ...
- ubuntu命令改变文档权限和所有者
chgrp :改变档案所属群组 chown :改变档案拥有者 chmod :改变档案的权限, SUID, SGID, SBIT等等的特性,可读.可写.可执行 1 chgrp 例子 chgrp [-R] ...
- 转载 - Ubuntu源改国内源 与 批量更改ubuntu机器apt源
change_apt_source.sh # !/bin/bash # 备份原来的源文件 cp /etc/apt/sources.list /etc/apt/sources.list.bak # 获取 ...
随机推荐
- jQuery表单验证组件BootstrapValidator
github:https://github.com/nghuuphuoc/bootstrapvalidator 参考博客:JS组件系列——Form表单验证神器: BootstrapValidator ...
- 【uoj#317】[NOI2017]游戏 2-SAT
题目描述 给出 $n$ 个赛车赛道和A.B.C三种赛车,除了 $d$ 个赛道可以使用所有三种赛车以外每个都只能使用给出的两种之一.另外给出 $m$ 条限制:某个赛道使用X则某另一个赛道必须使用Y.问: ...
- HttpHelper类及调用
首先列出HttpHelper类 /// <summary> /// Http操作类 /// </summary> public class HttpHelper { priva ...
- NHibernate常见错误
Oracle 下必须用 Sequence [PrimaryKey(PrimaryKeyType.Sequence,"ID")] 1.提示 ORA-02289: 序列不存在 -- C ...
- JavaWeb文件上传和下载
文件上传和下载在web应用中非常普遍,要在jsp环境中实现文件上传功能是非常容易的,因为网上有许多用java开发的文件上传组件,本文以commons-fileupload组件为例,为jsp应用添加文件 ...
- 【BZOJ1226】学校食堂(动态规划,状态压缩)
[BZOJ1226]学校食堂(动态规划,状态压缩) 题面 BZOJ 洛谷 题解 发现\(b\)很小,意味着当前这个人最坏情况下也只有后面的一小部分人在他前面拿到饭. 所以整个结果的大致顺序是不会变化的 ...
- 洛谷 P4093 [HEOI2016/TJOI2016]序列 解题报告
P4093 [HEOI2016/TJOI2016]序列 题目描述 佳媛姐姐过生日的时候,她的小伙伴从某宝上买了一个有趣的玩具送给他.玩具上有一个数列,数列中某些项的值可能会变化,但同一个时刻最多只有一 ...
- AtCoder Regular Contest 088 E - Papple Sort(树状数组+结论)
结论:每次把字符丢到最外面最优,用树状数组统计答案,把字符放到最外边后可以当成消失了,直接在树状数组上删掉就好. 感性理解是把字符丢到中间会增加其他字符的移动次数,但是丢到外面不会,所以是正确的. # ...
- PID控制算法的C语言实现八 变积分的PID控制算法C语言实现
变积分PID可以看成是积分分离的PID算法的更一般的形式.在普通的PID控制算法中,由于积分系数ki是常数,所以在整个控制过程中,积分增量是不变的.但是,系统对于积分项的要求是,系统偏差大时,积分作用 ...
- $('.goods_tag_ids_all')[0].checked = true;//~~~~~ 单条改变checkbox 属性样式
//点击左边全选选中时,都全选$('.goods_tag_ids_all').on('click',function(){ if($('.goods_tag_ids_all').is(':checke ...