EMP*_*EMP 35 linux ubuntu su shell cron
我在 Ubuntu 11.04 ( adduser --system) 中创建了一个“系统”用户来运行某些 cron 作业,但有时我想通过以该用户身份手动运行命令来测试一下。什么是最简单的方法来做到这一点?
adduser --system
su不起作用,因为用户有/bin/false它的外壳(这对 cron 很好)。我一直在手动更改外壳以/bin/bash进行测试,然后再次将其更改回来,但我想知道有没有更简单的方法?
su
/bin/false
/bin/bash
dmo*_*ati 45
我su - targetuser -s /bin/bash从 root shell 使用。
su - targetuser -s /bin/bash
对于直接命令执行使用-c:
-c
su - targetuser -s /bin/bash -c "/bin/echo hello world"
归档时间:
14 年,9 月 前
查看次数:
27662 次
最近记录:
8 年,11 月 前