I am writing an app on raspbian buster lite with .net core 3.1 and I need to start the app with sudo to have access to gpio.

Now I want to debug the app by attaching visual studio to the process.

If I start the process without "sudo" I am able to attach my debugger to the process..

But since I start the app with "sudo" (root) I'm unable to attach my debugger via ssh.

enter image description here


You have to connect as root. So in the "debug application" dialog, in the "connection target" field (where it currently says something like pi@ change this to root@ You'll be promted for the root password, which should be the same as for the pi user. If that doesn't work, ask google on how to allow root access by ssh on the Pi. This might need aditional configuration, but I don't remember the details.

| improve this answer | |

A step by step to make it works: Connect to the RaspberryPi with ssh or use the keyboard and console

write :

sudo nano /etc/ssh/sshd_config

Find the line "PermitRootLogin" and replace it like this :

PermitRootLogin yes

Ctrl+X Then Enter

Create a password for root :

sudo passwd root

then reboot with

sudo reboot

it's done with the raspberry!

In visual studio: Go to Debug/Options/Cross Platform

Add the ssh connection with the root username and the password you just created. Have fun!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.