Go to main content

手册页部分 1:用户命令

退出打印视图

更新时间: 2022年7月27日 星期三
 
 

pfsh (1)

名称

pfexec, pfbash, pfcsh, pfksh, pfsh, pftcsh, pfzsh, pfksh93 - 执行配置文件中的命令

用法概要

/usr/bin/pfexec command
/usr/bin/pfbash [ options ] [ argument ]...
/usr/bin/pfcsh [ options ] [ argument ]...
/usr/bin/pfksh [ options ] [ argument ]...
/usr/bin/pfsh [ options ] [ argument ]...
/usr/bin/pftcsh [ options ] [ argument ]...
/usr/bin/pfzsh [ options ] [ argument ]...
/usr/bin/pfksh93 [ options ] [ argument ]...
/usr/bin/pfrksh93 [ options ] [ argument ]...
/usr/bin/pfrksh [ options ] [ argument ]...
/usr/sunos/bin/pfksh [ options ] [ argument ]...
/usr/xpg4/bin/pfsh [ options ] [ argument ]...
/usr/bin/pfexec -P privspec command [ arg ]...

描述

pfexec 程序可设置 PRIV_PFEXEC 进程标志,并将当前进程标记为配置文件 shell。然后,它执行指定的命令。内核将查询 exec_attr(5) 数据库,并通过相应的属性执行。

搜索配置文件时会按照 user_attr(5) 数据库和 policy.conf(5) 中用户条目指定的顺序。对于每个用户,共有两组配置文件,即已验证集和未验证集。如果命令与已验证配置文件集对应的 exec_attr(5) 数据库中的条目匹配,用户在执行这些命令之前需要重新进行验证。如果从终端执行命令,系统会缓存当前用户和 tty 的验证状态,但该验证状态会受到为 PAM 堆栈 /etc/pam.d/pfexec 中的 pam_tty_tickets(7) 设置的超时选项的影响。如果当前没有 tty,但存在活动的 X11 会话,系统会通过 zenity(1) 对话框提示用户进行验证。This authentication state is cached for the current user and DISPLAY environment setting.

Processes that have been successfully reauthenticated, including those that were implicitly authenticated within the timeout value of the cache, are marked with an additional process flag, PRIV_PFEXEC_AUTH, which exempts child processes from subsequent reauthentication.Both the PRIV_PFEXEC and PRIV_PFEXEC_AUTH flags are inherited by child processes unless the real uid is changed.

与未验证配置文件集匹配的命令不需要进行重新验证,但其优先级低于已验证配置文件集中的命令。如果同一命令出现在多个配置文件中,则配置文件 shell 将使用第一个匹配的条目。

使用第二种形式 (pfexec –P privspec) 时,用户可以获取在 prof_attr(5) 中授予用户配置文件的附加特权。The privileges specification on the command line is parsed using priv_str_to_set(3C).得到的特权将先与在 prof_attr(5) 中使用 privs 关键字为所有用户配置文件指定的特权联合相交,并添加到可继承集,然后再执行命令。仅当用户成功进行重新验证后,才能获得已验证权限配置文件中的特权。

用法

pfexec 用于使用预定义的进程属性(例如特定用户或组 ID)执行命令。

Refer to the man pages for each shell for complete usage descriptions of the profile shells.

示例

示例 1 获取附加的用户特权
example% pfexec -P all chown user file

此命令仅以分配给当前用户的所有特权运行 chown user file,不必使用所有特权。

退出状态

将返回以下退出值:

0

成功完成。

1

出现错误。

属性

有关下列属性的说明,请参见 attributes(7)

属性类型
属性值
可用性
system/core-os

另请参见

bash(1), csh(1), ksh(1), ksh88(1), profiles(1), sh(1), tcsh(1), zsh(1), exec_attr(5), prof_attr(5), user_attr(5), attributes(7)

History

Support for authenticated profiles was added in Oracle Solaris 11.2.0.

The pfexec command was added in Solaris 8.