1

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

0

2 Answers 2

3

You have to connect as root. So in the "debug application" dialog, in the "connection target" field (where it currently says something like [email protected]) change this to [email protected]. 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.

2

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!

1
  • Why reboot in the end? sudo systemctl restart sshd.service won't work in raspbian?
    – rineez
    Commented Apr 14, 2022 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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