sealerio / sealer

Build, Share and Run Both Your Kubernetes Cluster and Distributed Applications (Project under CNCF)
http://sealer.cool
Apache License 2.0
2.04k stars 355 forks source link

problem with non root user #2298

Open Tom-abc opened 10 months ago

Tom-abc commented 10 months ago

What happen?

i'm trying to install k8s. if i let --user be root everything goes well, however if i let user be non root the process will fail, and su doesn't solve the problem

Relevant log output?

[ERROR] [root.go:75] sealer-v0.11.0: failed to detect rootfs cache /var/lib/sealer/data/my-cluster/rootfs/cache/image/1e08f61a9b71299e05ede5884a96e0e15c4554b6974432960e73ddafabfc3074 on host 192.168.195.22: failed to new sftp client of host(192.168.195.22): failed to execute cmd(sudo grep -oP "Subsystem\s+sftp\s+\K.*" /etc/ssh/sshd_config): Process exited with status 1

What you expected to happen?

success

How to reproduce it (as minimally and precisely as possible)?

sudo sealer run docker.io/sealerio/kubernetes:v1-22-15-sealerio-2 --masters 192.168.195.22 -u user -p passwd

Anything else we need to know?

No response

What is the version of Sealer you using?

0.11.0

What is your OS environment?

Ubuntu 22.04.2 LTS

What is the Kernel version?

Linux 5.15.90.1-microsoft-standard-WSL2

Other environment you want to tell us?

No response

Tom-abc commented 10 months ago

it seems that sudo requires the password which is not provided.

https://github.com/sealerio/sealer/blob/f07e804323994e922dce030da6a26c3ba93d22f1/utils/ssh/connect.go#L195

maybe echo password | sudo -S ... is an option.