crontab 设置_如何在Crontab中与其他用户一起设置作业?

crontab 设置

crontab 设置

I have some crontab jobs. I have set up them with root user. But there are some problems. The job does not work because of security issues that prevent job to run with the root user. How can I set a different user to run a crontab job to run a different user than the current user?

我有一些crontab工作。 我已经用root用户设置了它们。 但是有一些问题。 由于安全问题导致作业无法与root用户一起运行,因此该作业无法正常工作。 如何设置其他用户来运行crontab作业以运行与当前用户不同的用户?

Crontab (Crontab)

Crontab is used install, uninstall or list tables of cron daemon. As we know each user have their own tables because of the security restriction. To use crontab the user shouldn’t be defined in /etc/cron.eny

Crontab用于安装,卸载或列出cron守护程序的表。 众所周知,由于安全性限制,每个用户都有自己的表。 要使用crontab,不应在/etc/cron.eny中定义用户。

Crontab
Crontab
Crontab

用其他用户安装新作业 (Install New Job With Different User)

We will install a new job with a different user by providing username with -u parameter. As we know to use different user we should have root privileges.

通过为用户名提供-u参数,我们将与其他用户一起安装新作业。 我们知道要使用其他用户,我们应该具有root特权。

$ crontab -e -u ismail
Install New Job With Different User
Install New Job With Different User
用其他用户安装新作业

Every night the backup command will run

每天晚上备份命令将运行

列出不同用户的作业(List Jobs Of Different User)

We have added a new job for user ismail. We can list jobs of the different users. We will use crontab command with the -l and -u options.

我们为用户ismail添加了一个新作业。 我们可以列出不同用户的工作。 我们将使用带有-l-u选项的crontab命令。

$ crontab -l -u ismail
List Jobs Of Different User
List Jobs Of Different User
列出不同用户的作业
LEARN MORE  Schedule Jobs and Tasks With Windows At Command
了解更多信息使用Windows At Command计划作业和任务

翻译自: https://www.poftut.com/set-job-different-user-crontab/

crontab 设置

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值