手册页部分 1: 用户命令

退出打印视图

更新时间: 2014 年 7 月
 
 

auths(1)

名称

auths - 管理和列出授权

用法概要

auths [user]...
auths list [-S 
repository] [-vx] [-u 
user]
auths info [-S 
repository] [-v] [authorization]
auths check [-u 
user] authorization
auths add [-S 
repository] -t description 
     [-h help_file_path] 
authorization
auths modify [-S 
repository] [-t description]
     [-h help_file_path] 
authorization
auths remove [-S 
repository] authorization

描述

auths 命令在标准输出上显示已授予您或者随意指定的用户或角色的授权。授权是某些特权程序在确定用户是否可以执行受限功能时要检查的权限。

此命令还可以在 auth_attr(4) 数据库中创建和修改授权及其属性(在本地文件名称服务或 LDAP 名称服务中)。auths 命令还在标准输出上显示已授予您或者随意指定的用户或角色的授权。

管理员必须具有 "Rights Management"(权限管理)配置文件才能使用添加、修改或删除子命令管理 auth_attr(4) 数据库中的授权。

每个用户可以具有零个或多个授权。授权由全限定名表示,该名称可标识创建授权的组织及其控制的功能。按照 Java 约定,授权的分层组件由句点 (.) 分隔,以创建组织的逆序 Internet 域名开头,以授权类中的特定函数结尾。授权不能以句点 (.) 结尾。

星号 (*) 表示类中的所有授权。

user_attr(4)/etc/security/policy.conf 文件中查找用户的授权(请参见 policy.conf(4))。可在 user_attr(4) 中直接指定授权,或通过 prof_attr(4) 间接指定授权。也可以将授权作为缺省授权直接分配给系统中的每个用户,或者作为 /etc/security/policy.conf 文件中的缺省配置文件间接分配给每个用户。

对于每个用户,共有两组配置文件,即已验证集和未验证集。已验证集中的授权总是有效,但是未验证集中的授权仅在获得验证质询的成功响应后才变为有效。此类质询在用户执行匹配已验证配置文件集中条目的命令时自动发出。请参见 pfexec(1)

子命令

add [-S repository] -t description [-h help_file_path] authorization

在指定的名称服务系统信息库 (repository) 中创建指定的授权 (authorization)。

如果未指定系统信息库选项,则在文件名称服务中创建授权。

check [-u user] authorization

检查指定的授权 (authorization) 是否已授予指定的用户名 (user) 或当前用户。

如果用户具有相应的授权,则 auths 会以退出代码 0 退出。否则,该命令会返回大于 1 的退出代码。

info [-S repository] [-v] [authorization]

检查指定的授权 (authorization) 是否存在于指定的名称服务系统信息库 (repository),或基于 nsswitch.conf(4)nsswitch.conf(4) 进行查找。如果指定的授权存在,则会列出该授权,且 auths 以返回代码 0 退出。

如果未指定授权,auths 会列出指定的名称服务系统信息库中存在的所有授权,或基于 nsswitch.conf(4) 列出所有授权。

list [-S repository] [-vx] [-u user]

列出分配给指定用户 (user) 或当前用户的所有授权,如果未指定用户名,则基于名称服务系统信息库 (repository) 列出所有授权。

如果未指定系统信息库,则基于 nsswitch.conf(4) 查找信息。

modify [-S repository] [ -t description ] [ -h help_file_path]

修改指定名称服务系统信息库中的现有授权。如果未指定系统信息库,则修改基于 nsswitch.conf(4) 找到的第一个名称服务中的授权。

remove [-S repository] authorization

在指定的名称服务系统信息库 (repository) 中删除现有授权 (authorization)。

如果未指定系统信息库,则从基于 nsswitch.conf(4) 找到的第一个名称服务中删除授权。

选项

auths 子命令支持以下选项:

–h help_file_path

设置包含授权相关信息的帮助文件的位置。

–S repository

指定要修改或搜索的名称服务系统信息库 (repository)。支持的系统信息库选项为 filesldap

如果省略此选项,将基于 nsswitch.conf(4) 进行查找。

–t description

指定授权的文本描述。

–u user

指定要列出或检查其授权的用户名 (user)。

如果省略此选项,将使用当前用户。

–v

输出授权描述。

–x

仅列出授权。

示例

示例 1 使用 auths 命令

auths 的输出内容如下所示:


example% auths tester01 tester02
tester01 : solaris.system.date,solaris.jobs.admin
tester02 : solaris.system.*
example%

tester01 中的授权名称由逗号分隔,逗号后不加空格。

以下命令列出分配给用户 tester01 的授权。


example% auths list -u tester01

tester01:
solaris.jobs.admin
solaris.system.date

示例 2 列出授权

以下命令列出分配给用户 tester01 的授权及说明。

example% auths list -v -u tester01
tester01:
solaris.jobs.admin
Manage All Jobs
solaris.system.date
Set Date & Time


示例 3 列出授权

以下命令列出名称服务中的授权和描述。


example% auths info -v solaris.user.manage
solaris.user.manage:
Manage user accounts
example%

示例 4 添加授权

以下命令将授权 solaris.foo.manage 以及描述 manage foo 和帮助文件 AuthFoo.html 添加到文件名称服务系统信息库中。


example% auths add -t "manage foo"\
              -h /home/abc/AuthFoo.html solaris.foo.manage

示例 5 修改授权

以下示例在 LDAP 中修改授权 solaris.foo.manage,将描述设置为 manage foo and bar,将帮助文件设置为 AuthFooBar.html


example% auths -S ldap modify -t " manage foo and bars"\
              -h /home/abc/AuthFooBar.html solaris.foo.manage

退出状态

将返回以下退出值:

0

成功完成。

1

出现错误。

2

用户未经授权。

文件

/etc/user_attr

/etc/security/auth_attr

/etc/security/policy.conf

/etc/security/prof_attr

属性

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

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

另请参见

profiles(1)roles(1)getauthattr(3C)auth_attr(4)policy.conf(4)prof_attr(4)user_attr(4)attributes(5)