“Shell中用指定用户运行命令”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
(导入1个版本)
(导入1个版本)
 
(没有差异)

2019年10月14日 (一) 13:52的最新版本

Q

测试环境用的root跑的 线上安全些 不能用root 

source /etc/profile
su  -l ops  -c  "nohup  java  -jar  -Dspring.profiles.active=dev /home/ops/dev-cailuw-market/cailu-market-web-0.0.1.jar >/dev/null 2>&1 &"

手工执行看起来 有两个进程  程序哥就各位疑问 好尴尬  用jenkins跑完就不会啦

参数 

 -l, --login              make the shell a login shell

  -c, --command=COMMAND        pass a single COMMAND to the shell with -c

see also

shell中用指定用户运行命令 su

Linux 下使用指定的用户来执行命令


Linux 下以其他用户身份运行程序—— su、sudo、runuser