请命令使用root权限运行,如果它们在bash脚本内部通过root下的crontab执行的bash脚本
如果为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, usingsudo 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根用户和根本权限之间没有区别。
root
的crontab中的所有脚本都将以root
运行,其中所有命令也将以root
运行,并在所有相关的权限下运行。There is no difference between the root user and root permissions. All scripts in
root
's crontab will run asroot
, and all commands therein will also run asroot
, with all associated permissions.