coder / code-server

VS Code in the browser
https://coder.com
MIT License
67.89k stars 5.58k forks source link

[Bug]: `Public IP:Port` Unable to access code-server #6716

Closed MrMoe830 closed 7 months ago

MrMoe830 commented 7 months ago

Is there an existing issue for this?

OS/Web Information

Steps to Reproduce

  1. Download code-server-4.22.0-linux-amd64.tar.gz and upload it to the remote server via FTP.

  2. Execute the following command on the remote server: tar -xvf code-server-4.22.0-linux-amd64.tar.gz cd code-server-4.22.0-linux-amd64/ export PASSWORD="mypassword" ./bin/code-server --port 9999 --host 0.0.0.0 --auth password

  3. Then the remote server terminal displays the following information: 0be5c16b97a74c74dcc2903f003e1af

  4. Then, enter: public IP:9999 in the address bar of the local browser.

Expected

code-server connects successfully and asks for password(mypassword)

Actual

I got the following error message: 407890a3cdc9867d5c889536c4203ad

Logs

No response

Screenshot/Video

No response

Does this issue happen in VS Code or GitHub Codespaces?

Are you accessing code-server over a secure context?

Notes

There is also a personal blog website (www.techfan.top) running on my remote server, and my server is in mainland China. I have opened port permissions for port number 9999, but I still cannot access it successfully. I'm not sure if access to code-server failed because of a firewall or other factors that I didn't take into account.

Is it because my installation process is incorrect? I hope to get your help, thank you!

MrMoe830 commented 7 months ago

I have found the cause of the problem. It is due to the firewall failing to successfully release the port. I have two methods to solve the problem I encountered. The first method is to execute systemctl stop firewalld.service to shut down the firewall service. The other method is to execute firewall-cmd --zone=public --add-port=9999/tcp --permanent to configure permanent release permissions for the port. .