Skip to content

Commit f4740c8

Browse files
committed
Replace sudo with su for docker:shell
1 parent 88dd4ec commit f4740c8

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/app/CliTools/Console/Command/Docker/ShellCommand.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,10 @@ public function execute(InputInterface $input, OutputInterface $output)
8181
$command = new RemoteCommandBuilder('bash');
8282

8383
if (!empty($cliUser)) {
84-
// sudo wrapping as cli user
85-
$commandSudo = new RemoteCommandBuilder('sudo', '-H -E -u %s', array($cliUser));
86-
$commandSudo->addArgumentTemplate('TERM=%s', getenv('TERM'));
87-
$commandSudo->append($command, false);
88-
$command = $commandSudo;
84+
// su wrapping as cli user
85+
$commandSu = new RemoteCommandBuilder('su', '-l %s -m', array($cliUser));
86+
$commandSu->addArgumentTemplate('-c "TERM=%s %s"', getenv('TERM'), $command);
87+
$command = $commandSu;
8988
}
9089

9190
$ret = $this->executeDockerExec($container, $command);

0 commit comments

Comments
 (0)