Skip to content

Instantly share code, notes, and snippets.

@bluPhy
Last active December 20, 2023 05:25
Show Gist options
  • Save bluPhy/882f72784bdd6a9167d2d78f4e7bf35a to your computer and use it in GitHub Desktop.
Save bluPhy/882f72784bdd6a9167d2d78f4e7bf35a to your computer and use it in GitHub Desktop.
workaround hack to open vscode remote as root without logging in as root
#!/bin/bash
# Backup the original server.sh file
cp ~/.vscode-server/bin/*/server.sh ~/.vscode-server/bin/server.sh.bak
# Add sudo to node runner in server.sh
if sed -i "/node/s/^/sudo /" ~/.vscode-server/bin/*/server.sh; then
echo "sudo added to node runner in server.sh"
else
echo "Failed to add sudo to node runner. Please check the sed command."
exit 1
fi
# Restart remote vscode
pkill -f vscode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment