请命令使用root权限运行,如果它们在bash脚本内部通过root下的crontab执行的bash脚本

发布于 2025-02-01 09:51:46 字数 385 浏览 1 评论 0原文

如果为Linux下的根用户创建了crontab,则使用 sudo crontab -e,然后由crontab直接运行的任何东西都将使用root权限 - 请参见可以使bash文件作为root in crontab中的root?

这是否意味着中的任何命令 em> bash脚本还将继承根本权限,或者需要使用root权限(例如sudo docker ps ps )明确执行bash脚本中的任何命令?

If a crontab is created for the root user under Linux, using
sudo crontab -e, then anything that's directly run by the crontab will use root permissions - see Is it possible to make a Bash file run as root in crontab?

Does this mean that any commands within the bash script will also inherit root permissions, or will any commands within the bash script need to be explicitly executed with root permissions e.g. sudo docker ps?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

少女的英雄梦 2025-02-08 09:51:46

根用户和根本权限之间没有区别。 root的crontab中的所有脚本都将以root运行,其中所有命令也将以root运行,并在所有相关的权限下运行。

There is no difference between the root user and root permissions. All scripts in root's crontab will run as root, and all commands therein will also run as root, with all associated permissions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文