linux 指定用户 启动 程序

sudo -H -u {username} /bin/bash -c "python test.py &"

"&"  后台运行指令

本人亲测可用,切换到root权限后,指定了 lowman 用户运行 test.py 文件:

原文地址:https://www.cnblogs.com/lowmanisbusy/p/11573520.html