ShuiMuNianHuaLP opened a new issue #8366:
URL: https://github.com/apache/dolphinscheduler/issues/8366


   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   Hello, I don't want to use 「sudo-u」 scheduling tasks
   
   so change 「conf/common.properties」 this configuration:
   
   ```shell
   # use sudo or not, if set true, executing user is tenant user and deploy 
user needs sudo permissions; if set false, executing user is the deploy user 
and doesn't need sudo permissions
   sudo.enable=false
   ```
   
   
   
   but is invalid
   
   shell task still use  「sudu -u」.
   
   log info:
   …..
   [INFO] 2022-02-10 08:34:18.661 TaskLogLogger-class 
org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[285] - task run 
command: sudo -u hadoop sh 
/home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15/13_15.command
   [INFO] 2022-02-10 08:34:18.664 TaskLogLogger-class 
org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[176] - process start, 
process id is: 92386
   [INFO] 2022-02-10 08:34:18.671 TaskLogLogger-class 
org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[200] - process has 
exited, execute 
path:/home/hadoop/dolphinscheduler/temp/exec/process/4462120816128/4465215383552_1/13/15,
 processId:92386 ,exitStatusCode:1 ,processWaitForStatus:true 
,processExitValue:1
   [INFO] 2022-02-10 08:34:19.664 TaskLogLogger-class 
org.apache.dolphinscheduler.plugin.task.shell.ShellTask:[66] -  -> welcome to 
use bigdata scheduling system...
        hadoop 不在 sudoers 文件中。此事将被报告。
   …...
   
   ### What you expected to happen
   
   I think it would not use [sudo -u ] scheduling
   
   ### How to reproduce
   
   use this config:
   
   ```shell
   # use sudo or not, if set true, executing user is tenant user and deploy 
user needs sudo permissions; if set false, executing user is the deploy user 
and doesn't need sudo permissions
   sudo.enable=false
   ```
   
   
   ### Anything else
   
   **source code in class:**
   
   Is it fixed to use [sudo-u]
   
   
org.apache.dolphinscheduler.plugin.task.api.AbstractCommandExecutor#buildProcess
   ```java
       private void buildProcess(String commandFile) throws IOException {
           // setting up user to run commands
           List<String> command = new LinkedList<>();
   
           //init process builder
           ProcessBuilder processBuilder = new ProcessBuilder();
           // setting up a working directory
           processBuilder.directory(new File(taskRequest.getExecutePath()));
           // merge error information to standard output stream
           processBuilder.redirectErrorStream(true);
   
           // setting up user to run commands
           command.add("sudo");
           command.add("-u");
           command.add(taskRequest.getTenantCode());
           command.add(commandInterpreter());
           command.addAll(Collections.emptyList());
           command.add(commandFile);
   
           // setting commands
           processBuilder.command(command);
           process = processBuilder.start();
   
           printCommand(command);
       }
   ```
   
   ### Version
   
   2.0.2
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to