blog/content/homelab/vscode-alpine.md

55 lines
1.7 KiB
Markdown
Raw Normal View History

2023-06-11 16:09:07 +02:00
---
title: "Use VSCode Remote on Alpine Linux hosts"
date: 2023-06-11T16:01:44+02:00
2023-06-11 16:09:58 +02:00
draft: false
2023-06-11 16:09:07 +02:00
author: "Mathieu Broillet"
cover : "img/vscode.png"
# coverAlt : "alt image"
# coverCaption : "credit of image"
description : "Microsoft not even capable of adding a few commands to their install script..."
tags : ['docker', 'watchtower']
---
When it comes to Microsoft, it's not uncommon to encounter unresolved issues, and one such case is using the VSCode remote agent on Alpine Linux.
By default, Alpine Linux utilizes Dropbear, which isn't compatible with remote development in VSCode. However, fret not! I've got a few commands that can help you overcome this hurdle and add support for Alpine.
{{< code language="BASH" title="Add Alpine support for Remote VSCode" expand="Show" collapse="Hide" isCollapsed="false" >}}
# Stop and remove Dropbear
rc-service dropbear stop
rc-update del dropbear
apk del dropbear* -f
# Stop and remove SSHD
rc-service sshd stop
rc-update del sshd
apk del openssh* -f
# Clean up Dropbear and SSH configurations
rm -rf /etc/dropbear
rm -rf /etc/ssh
rm /etc/init.d/ssh
# Reboot now if needed
# reboot now
# Install OpenSSH and necessary packages
apk add openssh gcompat libstdc++ curl bash git grep
apk add procps --no-cache
# Start and add SSHD to startup
rc-service sshd start
rc-update add sshd
# Update AllowTcpForwarding setting
sed -i 's/^#*AllowTcpForwarding.*/AllowTcpForwarding yes/' /etc/ssh/sshd_config
# Update PermitTunnel setting
sed -i 's/^#*PermitTunnel.*/PermitTunnel yes/' /etc/ssh/sshd_config
# Uncomment the line if needed (remove '#' at the beginning)
sed -i 's/^#PermitTunnel.*/PermitTunnel yes/' /etc/ssh/sshd_config
# Restart the SSH service to apply the changes
/etc/init.d/sshd restart
{{< /code >}}