On Mon, Dec 21, 2020 at 10:13:29AM +0800, Xiao Shenwei wrote:
[why] systemctl is not supported when use docker
[how] use the sshd command
Signed-off-by: Xiao Shenwei xiaoshenwei96@163.com
daemon/sshd | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/daemon/sshd b/daemon/sshd index 41fa99adf..6bfda467e 100755 --- a/daemon/sshd +++ b/daemon/sshd @@ -6,19 +6,31 @@ # sshr_port_base
. $LKP_SRC/lib/http.sh +. $LKP_SRC/lib/env.sh
Best practice is to use realpath.
SCRIPT_DIR=$(dirname $(realpath $0)) PROJECT_DIR=$(dirname $SCRIPT_DIR) $PROJECT_DIR/lib/http.sh $PROJECT_DIR/lib/env.sh
Thanks, Chenglong
sshr_ip=$LKP_SERVER [ -n "$sshr_port" ] || sshr_port=5050 [ -n "$sshr_port_len" ] || sshr_port_len=2000 [ -n "$sshr_port_base" ] || sshr_port_base=50000
+generate_key_file() +{
- echo -e "y\n" | ssh-keygen -t rsa -b 2048 -N '' -f /etc/ssh/ssh_host_rsa_key
+}
run_ssh() { [ -n "$my_ssh_pubkey" ] || return umask 0077 mkdir -p /root/.ssh echo "$my_ssh_pubkey" > /root/.ssh/authorized_keys
- systemctl start sshd
- if is_docker; then
generate_key_file
sshd_path=$(cmd_path sshd)
$sshd_path -q
- else
systemctl start sshd
- fi
}
data_success()
2.23.0