linuxserver / docker-code-server

GNU General Public License v3.0
1.63k stars 327 forks source link

[BUG] Sudo password not being set using env vars #168

Closed tholeb closed 5 months ago

tholeb commented 8 months ago

Is there an existing issue for this?

Current Behavior

I can't sudo while in the container, the password is always incorrect, even though in the logs there is :

setting up sudo access
adding abc to sudoers

I checked the sudoers list, and the abc user is not present (grep -Po '^sudo.+:\K.*$' /etc/group).

Expected Behavior

access to sudo after password

Steps To Reproduce

  1. Log to code-server
  2. sudo su -

  3. enter password
  4. incorrect password

Environment

- OS: Ubuntu 22.04 LTS
- How docker service was installed:

`sudo apt install podman`

CPU architecture

arm64

Docker creation

- name: VSCode - Run container using podman
  containers.podman.podman_container:
    name: vscode
    image: linuxserver/code-server:latest
    state: started
    recreate: true
    volume:
      - vscode-storage:/workspace
      - vscode-config:/config
    restart_policy: on-failure
    ports:
      - 1029:8443
    env:
      PUID: 1000
      PGID: 1003
      TZ: Europe/Paris
      HASHED_PASSWORD: "{{ vscode_password_hash.stdout }}"
      SUDO_PASSWORD_HASH: "{{ sudo_password_hash.stdout }}"
      DEFAULT_WORKSPACE: /workspace
    generate_systemd:
      path: /etc/systemd/system
      new: true
      time: 120
  notify:
    - Systemd daemon reload
    - Restart vscode

1000:1003 is a user from my raspberry, I run the Ansible playbook with become: root


### Container logs

```bash
[migrations] started
[migrations] no migrations found
usermod: no changes
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    911
User GID:    911
───────────────────────────────────────

setting up sudo access
adding abc to sudoers
setting sudo password using sudo password hash
[custom-init] No custom files found, skipping...
[2024-01-09T16:06:59.970Z] info  code-server 4.20.0 d0215eca8804d0be5d3551c39404e336032c3141
[2024-01-09T16:06:59.975Z] info  Using user-data-dir /config/data
[2024-01-09T16:07:00.032Z] info  Using config file /config/.config/code-server/config.yaml
[2024-01-09T16:07:00.033Z] info  HTTP server listening on http://0.0.0.0:8443/
[2024-01-09T16:07:00.033Z] info    - Authentication is enabled
[2024-01-09T16:07:00.033Z] info      - Using password from $HASHED_PASSWORD
[2024-01-09T16:07:00.034Z] info    - Not serving HTTPS
[2024-01-09T16:07:00.034Z] info  Session server listening on /config/data/code-server-ipc.sock
[ls.io-init] done.
[17:07:00]

[17:07:01] Extension host agent started.
File not found: /app/code-server/lib/vscode/out/vsda_bg.wasm
File not found: /app/code-server/lib/vscode/out/vsda.js
[17:07:06] [192.168.1.21][ea210247][ManagementConnection] New connection established.
[17:07:07] [192.168.1.21][f07cfa04][ExtensionHostConnection] New connection established.
[17:07:07] [192.168.1.21][f07cfa04][ExtensionHostConnection] <225> Launched Extension Host Process.
github-actions[bot] commented 8 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

LinuxServer-CI commented 7 months ago

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 4 months ago

This issue is locked due to inactivity