yuhJohn opened a new issue, #899:
URL: https://github.com/apache/mina-sshd/issues/899
Question 1:
The ssh-copy-id command is not supported. This is actually a standard
command for ssh.
clientInput:
`ssh-copy-id -p 123 -i /root/.ssh/id_rsa.pub user@ip`
and received the following command
`exec sh -c'cd; umask 077; mkdir -p \".ssh\" && {[-z `tail -1c
.ssh/authorized_keys 2>/dev/null`] || echo >> \".ssh/authorized_keys\" || exit
1;} && cat >> \".ssh/authorized_keys\" || exit 1; if type restorecon >/dev/null
2>&1; then restorecon -F \".ssh\" \".ssh/authorized_keys\"; fi'`
The exec cannot be identified. As a result, the execution fails.
I solved this by customizing exec judgment.
```
public Command createCommand(ChannelSession channel, String command)
throws IOException {
LOGGER.error("create Command: " + command);
if (command !=null && command.startsWith("exec ")) {
command = command.substring(5);
}
return new ShellWrapperCommand(command);
}
```
Question 2: Multiple commands such as " ls -l; rm -rf /tmp/test" cannot be
executed correctly.
The input is as follows:
`ssh user@IP -p 123 "echo test2; echo 22"`
The actual output is
`test2; echo 22`
I understand that the preceding two questions are very common scenarios. Is
SSHD not supported by default?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]