是否可以在 Linux 或 BSD 系统上自定义sudo
“将报告此事件”消息?我已经在man sudo
和man sudoers
一个Ubuntu 16.04的机器,一台FreeBSD 10.2机器,并在Fedora 23的机器上,我还没有发现任何有用的东西。
Rah*_*hul 30
从sudoers的手册下面是你被允许与须藤的conf配置的唯一消息。
badpass_message="Sorry, try again."
Run Code Online (Sandbox Code Playgroud)
但是,要回答您的问题,我们非常欢迎您编译自己的 sudo 副本。
这将是您收到的消息。
meu*_*euh 14
从某种意义上说,这条消息已经是可定制的,因为对于 GNU/Linux 的许多部分来说,它sudo
是国际化的,并且使用gettext
本地语言支持来查找大多数字符串以将它们替换为不同语言的区域设置版本。
例如,您可以在此处查看包含条目的法语文件:
msgid "%s is not in the sudoers file. This incident will be reported.\n"
msgstr "%s n'apparaît pas dans le fichier sudoers. Cet événement sera signalé.\n"
msgid "%s is not allowed to run sudo on %s. This incident will be reported.\n"
msgstr "%s n'est pas autorisé à exécuter sudo sur %s. Cet événement sera signalé.\n"
Run Code Online (Sandbox Code Playgroud)
那么,要更改您需要为哪种语言/区域设置指定的消息?并编辑相应的 NLS 文件。但是,用户可能没有使用区域设置,因此这将不起作用。
或者,您可以使用二进制编辑器将 中出现的字符串替换为大小完全相同且参数数量相同/usr/libexec/sudo/sudoers.so
的字符串。由于这将不再与翻译匹配,它将适用于所有语言环境。例如%s
gettext
sed < /usr/libexec/sudo/sudoers.so 's/This incident will be reported/This incident WILL BE REPORTED/' >/tmp/sudoers.so
cmp -l /usr/libexec/sudo/sudoers.so /tmp/sudoers.so
Run Code Online (Sandbox Code Playgroud)
使用cmp
,以确保你有没有损坏的文件。
归档时间: |
|
查看次数: |
4468 次 |
最近记录: |