我在/etc/profile.d/run1.sh中有一个bash脚本,我希望所有用户都可以在登录时运行:
#!/bin/bash
# run1.sh
sudo /usr/local/bin/run2.bash
每个人都可以读取和执行该文件(chmod 755)
登录时会显示一个图形对话框,其中包含以下文本:
Error found when loading /etc/profile:
unknown': I need something more specific.
As a result the session will not be configured correctly.
You should fix the problem as soon as feasible.
[OK]
可以在https://share.icloud.com/photos/0rFXpZNltiSogcz1hzlmWTIUg上看到更精确的屏幕截图
/etc/profile.d中的脚本用于使用sudo启动另一个脚本。该脚本在/etc/sudoers.d/run_script
的特殊文件中标识:
ALL ALL=NOPASSWD: /usr/local/bin/run2.bash
对我想念的东西有什么想法吗?