Skip to content

Instantly share code, notes, and snippets.

@janaSunrise
Last active November 27, 2020 05:20
Show Gist options
  • Save janaSunrise/4d64e5a36ca455964595824b024ffd2a to your computer and use it in GitHub Desktop.
Save janaSunrise/4d64e5a36ca455964595824b024ffd2a to your computer and use it in GitHub Desktop.
This is the systemd service, That will enable the process to keep running, until Manually stopped, and Also Automatically will bind to the port specified.
[Unit]
Description=code-server
After=network.target
[Service]
Type=simple
Environment=PASSWORD=your_password_here
ExecStart=/usr/bin/code-server --bind-addr 0.0.0.0:8080 --user-data-dir /var/lib/code-server --auth password
Restart=always
RestartSec=10
User=<your-user>
Group=<your-group>
WorkingDirectory=<working-dir>
[Install]
WantedBy=multi-user.target
@janaSunrise
Copy link
Author

janaSunrise commented Nov 13, 2020

Now follow these steps:
⚠️ Remember to replace your_password_here with your desired password. And <you-user> with the user name.

  • To enable it: sudo systemctl enable code-server
  • To check it's status: sudo systemctl status code-server
  • To run it on reboot: sudo systemctl enable code-server
  • To allow public access through firewall: sudo ufw allow 8080 or the Port you added, and then sudo ufw reload

😁 And You can access it here ➡️ <your_ip>:<your_port_specified>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment