iT邦幫忙

0

請問在 k8s POD 裡面可以 SUDO SU 嗎 

  • 分享至 

  • xImage

請問在 k8s POD 裡面可以 SUDO SU 嗎 
kubectl exec -ti xxxxPOD -- /bin/sh
sudo su
做了之後給我錯誤訊息

https://imgur.com/a/nlTgjVK

sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0
yoloshiku
iT邦新手 3 級 ‧ 2022-10-06 09:06:12

想不到預設不能sudo su的理由,你有試過其他container嗎? 我自己k8s的pod是沒有問題,感覺是image相關的問題

https://github.com/docker/for-linux/issues/1100

恩恩 感覺是 image 問題,但他設定 不能的話 我去改這個
Well actually, that's how sudo works...
Your user executes the binary /usr/bin/sudo
/usr/bin/sudo has the Sticky Bit set for the User (aka SUID) and the file is owned by the root user to the program will run as root even though you executed it as a non-root user.
/usr/bin/sudo reads the configuration files in /etc and will execute other commands as allowed by the configuration files.
應該 應該也是沒權限吧 這個不是要ROOT 才能改嗎 ??

我要發表回答

立即登入回答