Skip to content

[Bug]: When I run code-server with sudo, it said incorrect password. #6380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4 tasks done
DaShenZi721 opened this issue Aug 9, 2023 · 7 comments
Closed
4 tasks done
Labels
bug Something isn't working triage This issue needs to be triaged by a maintainer

Comments

@DaShenZi721
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

OS/Web Information

Web Browser: Chrome
Local OS: Windows 10
Remote OS: Ubuntu 20.04
Remote Architecture:
code-server --version: 4.10.1

Steps to Reproduce

run sudo code-server --port 8080 --host 0.0.0.0 --auth password
login page
enter password on config.yaml file and show Incorrect password

Expected

Login successfully

Actual

Incorrect password

Logs

[2023-08-09T13:33:23.584Z] info code-server 4.10.1 d477972
[2023-08-09T13:33:23.586Z] info Using user-data-dir ~/.local/share/code-server
[2023-08-09T13:33:23.614Z] info Using config file ~/.config/code-server/config.yaml
[2023-08-09T13:33:23.614Z] info HTTP server listening on http://0.0.0.0:8080/
[2023-08-09T13:33:23.614Z] info - Authentication is enabled
[2023-08-09T13:33:23.614Z] info - Using password from ~/.config/code-server/config.yaml
[2023-08-09T13:33:23.614Z] info - Not serving HTTPS
Failed login attempt {"remoteAddress":"10.9.64.80","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36","timestamp":1691588009}

Screenshot/Video

No response

Does this issue happen in VS Code or GitHub Codespaces?

  • I cannot reproduce this in VS Code.
  • I cannot reproduce this in GitHub Codespaces.

Are you accessing code-server over HTTPS?

  • I am using HTTPS.

Notes

When I run code-server with sudo, I encountered the issue (incorrect password). However, it worked without sudo.

@DaShenZi721 DaShenZi721 added bug Something isn't working triage This issue needs to be triaged by a maintainer labels Aug 9, 2023
@code-asher
Copy link
Member

code-asher commented Aug 9, 2023 via email

@DaShenZi721
Copy link
Author

DaShenZi721 commented Aug 10, 2023

Which config.yaml? If you are using sudo then the home directory will be /root, so the config file will be in /root/.config/code-server/config.yaml. It is not recommended to run code-server as root though.

But there isn't the config file in /root/.config/code-server/config.yaml

@code-asher
Copy link
Member

code-asher commented Aug 10, 2023 via email

@code-asher
Copy link
Member

I made a change that outputs the full path so if you are still running into this please upgrade and try again. Please feel free to comment and we can re-open if there is still a bug.

@wiseeker
Copy link

Hello this exact same issue is happening to me. Though, one thing to note is I'm using docker image to run code-server. Below is the output when I run docker command - as provided by the website. But no such config file can be found!

Where is it writing default config file to in case of docker + sudo?

~$ sudo ./runcoder.sh
[sudo] password for ???:
[2025-03-20T06:03:20.635Z] info Wrote default config file to /root/.config/code-server/config.yaml
[2025-03-20T06:03:21.045Z] info code-server 4.98.2 e2c489dd00f163b1a8d959965b0c30c1a978a080
[2025-03-20T06:03:21.047Z] info Using user-data-dir /root/.local/share/code-server
[2025-03-20T06:03:21.069Z] info Using config file /root/.config/code-server/config.yaml
[2025-03-20T06:03:21.069Z] info HTTP server listening on http://0.0.0.0:8080/
[2025-03-20T06:03:21.069Z] info - Authentication is enabled
[2025-03-20T06:03:21.069Z] info - Using password from /root/.config/code-server/config.yaml
[2025-03-20T06:03:21.070Z] info - Not serving HTTPS
[2025-03-20T06:03:21.070Z] info Session server listening on /root/.local/share/code-server/code-server-ipc.sock

@code-asher
Copy link
Member

It should be in /root/.config/code-server/config.yaml as noted by the output. Are you sure that does not exist within the Docker container?

@wiseeker
Copy link

Yes! It does inside the container. Thank you for pointing that out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage This issue needs to be triaged by a maintainer
Projects
None yet
Development

No branches or pull requests

3 participants