创建安全消息以供用户查看时,请从以下几种方法中选择一种:验证前查看、验证后查看或验证前后均可查看。/etc/issue 文件会在验证前显示,而 /etc/motd 文件会在验证后显示。
有关更多信息,请在桌面上单击 "System"(系统)-> "Help"(帮助)菜单以启动 GNOME 帮助浏览器。您也可以使用 yelp 命令。在 gdm(1M) 手册页的 “GDM Login Scripts and Session Files”(GDM 登录脚本和会话文件)部分介绍了桌面登录脚本。
开始之前
要创建文件,您必须承担 root 角色。要修改现有文件,您必须成为具有 solaris.admin.edit/path-to-existing-file 授权的管理员。
创建验证前对话框的选项使用 /etc/issue 文件(来自如何在标题文件中放置安全消息 的Step 1)中的安全消息。
/etc/gdm 目录包含三个初始化脚本,它们分别在验证前、验证后以及验证前后显示安全消息。
# pfedit /etc/gdm/Init/Default /usr/bin/zenity --text-info --width=800 --height=300 \ --title="Security Message" --filename=/etc/issue
有关以非 root 用户身份编辑系统文件的信息,请参见 pfedit(1M) 手册页。
登录窗口将扩大以容纳您的消息。此方法不指向 /etc/issue 文件。必须将文本键入 GUI。
# cd /usr/share/gdm
# cp gdm-greeter-login-window.ui /etc/gdm/gdm-greeter-login-window.ui.orig
glade-3 程序将打开 GTK+ 接口设计程序。将安全消息键入在用户输入字段上方显示的标签。
# /usr/bin/glade-3 /usr/share/gdm/gdm-greeter-login-window.ui
要查看接口设计程序指南,请在 GNOME 帮助浏览器中单击 "Development"(开发)。glade-3(1) 手册页列在 "Manual Pages"(手册页)的 "Applications"(应用程序)下。
# cp gdm-greeter-login-window.ui /etc/gdm/gdm-greeter-login-window.ui.site
创建验证后对话框的选项使用 /etc/motd 文件(来自如何在标题文件中放置安全消息 的Step 2)中的安全消息。
# pfedit /etc/gdm/PreSession/Default /usr/bin/zenity --text-info --width=800 --height=300 \ --title="Security Message" --filename=/etc/motd
# pfedit /usr/share/gdm/autostart/LoginWindow/banner.desktop [Desktop Entry] Type=Application Name=Banner Dialog Exec=/usr/bin/zenity --text-info --width=800 --height=300 \ --title="Security Message" \ --filename=/etc/motd OnlyShowIn=GNOME; X-GNOME-Autostart-Phase=Application
在登录窗口中进行验证后,用户必须关闭安全消息窗口才能访问工作区。有关 zenity 命令的选项,请参见 zenity(1) 手册页。
在本示例中,管理员键入一条简短消息作为桌面文件中 zenity 命令的参数。管理员还使用 –-warning 选项在消息中显示警告图标。
# pfedit /usr/share/gdm/autostart/LoginWindow/bannershort.desktop [Desktop Entry] Type=Application Name=Banner Dialog Exec=/usr/bin/zenity --warning --width=800 --height=150 --title="Security Message" \ --text="This system serves authorized users only. Activity is monitored and reported." OnlyShowIn=GNOME; X-GNOME-Autostart-Phase=Application