以普通用户身份执行程序(同时是 root)

Execute program as normal user (while being root)

我正在开发 Debian 8 (Jessie)(64 位)。我想 运行 以普通用户身份编程,而不创建和切换普通用户帐户。

我正在运行从bash脚本中编译主程序:

screen ./run

其中 运行 包含:

#!/bin/bash
ulimit -c unlimited
while true; do ./tfs --log-file "output.txt" "error.txt" | tee out.txt; done

我想运行 'tfs' 成为普通用户

sudo -u username 

是您要查找的命令。

我建议:

su - -c "screen /path/to/run" username