gpt4 book ai didi

linux - 如何使用 shell 脚本在/etc/sudoers 文件的末尾添加一行(不使用 pssh 工具)

转载 作者:太空宇宙 更新时间:2023-11-04 12:37:21 25 4
gpt4 key购买 nike

我想在/etc/sudoers 文件的末尾附加几行。下面是我要附加的行的示例。

nagios ALL = NOPASSWD: /bin/su - root -c /etc/init.d/crond status
nagios ALL = NOPASSWD: /bin/su - hadoop -c hadoop dfsadmin -safemode get
nagios ALL = NOPASSWD: /bin/su - hadoop -c klist

谁能建议如何使用 shell 脚本附加这个?

最佳答案

cat >> /etc/sudoers << EOF
nagios ALL = NOPASSWD: /bin/su - root -c /etc/init.d/crond status
nagios ALL = NOPASSWD: /bin/su - hadoop -c hadoop dfsadmin -safemode get
nagios ALL = NOPASSWD: /bin/su - hadoop -c klist
EOF

关于linux - 如何使用 shell 脚本在/etc/sudoers 文件的末尾添加一行(不使用 pssh 工具),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41298208/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com