如何创建和填充 /etc/shells
此文件未包含在标准发行版中。如果要允许用户使用 .forward 文件将邮件转发到程序或文件,则必须添加该文件。您可以通过使用 grep 标识口令文件中列出的所有 shell,手动创建该文件。然后,可将这些 shell 键入到文件中。但是,使用可下载脚本的以下过程更易于使用。
- 下载脚本。
http://www.sendmail.org/vendor/sun/gen-etc-shells.htmlhttp://www.sendmail.org/vendor/sun/gen-etc-shells.html
- 成为管理员。
有关更多信息,请参见在 Oracle Solaris 11.2 中确保用户和进程的安全
中的使用所指定的管理权限。
- 要生成 shell 列表,请运行 gen-etc-shells 脚本。
# ./gen-etc-shells.sh > /tmp/shells
此脚本使用 getent 命令收集 svc:/system/name-service/switch 服务中列出的口令文件源所包含的 shell 名称。
- 检查并编辑 /tmp/shells 中的 shell 列表。
使用您选择的编辑器,删除不包含的所有 shell。
- 将文件移动到 /etc/shells。
# mv /tmp/shells /etc/shells