成為超級使用者,或成為提供 solaris.cluster.admin RBAC 授權的角色。
選取建立角色的方法﹕
對於本機範圍內的角色,請使用 roleadd(1M) 指令指定新的本機角色及其特性。
或者,對於本機範圍內的角色,可以使用 type=role 來編輯 user_attr(4) 檔案,以增加使用者。
請僅在緊急情況下使用此方法,因為在鍵入時很容易出錯。
對於名稱服務內的角色,請使用 smrole(1M) 指令指定新角色及其屬性。
此指令需要超級使用者或能夠建立其他角色的角色授權。您可以將 smrole 套用至所有的名稱服務。此指令執行時,會成為 Solaris 管理主控台伺服器的用戶端。
啟動與停止名稱服務快取常駐程式。
新角色直到重新啟動名稱服務快取常駐程式後才會生效。以 root 的角色,輸入以下文字:
# /etc/init.d/nscd stop # /etc/init.d/nscd start |
以下序列說明了如何使用 smrole 指令建立角色。在此範例中,建立了新版本的操作者角色,並且為其指定了標準操作者權限設定檔以及媒體復原權限設定檔。
% su primaryadmin # /usr/sadm/bin/smrole add -H myHost -- -c "Custom Operator" -n oper2 -a johnDoe \ -d /export/home/oper2 -F "Backup/Restore Operator" -p "Operator" -p "Media Restore" Authenticating as user: primaryadmin Type /? for help, pressing <enter> accepts the default denoted by [ ] Please enter a string value for: password :: <type primaryadmin password> Loading Tool: com.sun.admin.usermgr.cli.role.UserMgrRoleCli from myHost Login to myHost as user primaryadmin was successful. Download of com.sun.admin.usermgr.cli.role.UserMgrRoleCli from myHost was successful. Type /? for help, pressing <enter> accepts the default denoted by [ ] Please enter a string value for: password ::<type oper2 password> # /etc/init.d/nscd stop # /etc/init.d/nscd start |
若要檢視新建立的角色 (以及任何其他角色),請使用帶 list 選項的 smrole,如下所示:
# /usr/sadm/bin/smrole list -- Authenticating as user: primaryadmin Type /? for help, pressing <enter> accepts the default denoted by [ ] Please enter a string value for: password :: <type primaryadmin password> Loading Tool: com.sun.admin.usermgr.cli.role.UserMgrRoleCli from myHost Login to myHost as user primaryadmin was successful. Download of com.sun.admin.usermgr.cli.role.UserMgrRoleCli from myHost was successful. root 0 Super-User primaryadmin 100 Most powerful role sysadmin 101 Performs non-security admin tasks oper2 102 Custom Operator |