a7md0
Posts: 3
Joined: Tue Jun 04, 2019 1:25 am

[VNC] Enable access for new user?

Tue Jun 04, 2019 1:35 am

Basically, I have VNC enabled from raspi-config and created new user with sudo permission. When I try to connect from VNC Viewer, I receive "Access is denied" error.

I did some search and found out that I should login using pi user and give access to other users from GUI. Unfortunately, I already deleted pi user completely. I cannot find any document about giving user permission from CLI :(

Is there anyway to do that without going into GUI?

User avatar
sconemad
Posts: 228
Joined: Thu Apr 28, 2016 1:47 pm
Location: Cambridge, UK
Contact: Website

Re: [VNC] Enable access for new user?

Tue Jun 04, 2019 8:57 am

The default settings are to allow access to anyone in the sudo group. Is this how you enabled sudo access for your user (or did you add the user to /etc/sudoers)?

Alternatively, you can set the VNC permissions to allow your user directly. The file you need to edit is /root/.vnc/config.d/vncserver-x11 and
you'll need to add (or edit) the "Permissions" line, as described here:
https://www.realvnc.com/en/connect/docs ... ermissions

Something like this should do it:

Code: Select all

Permissions=user:f
Where user is your username, and 'f' means full permissions.

a7md0
Posts: 3
Joined: Tue Jun 04, 2019 1:25 am

Re: [VNC] Enable access for new user?

Thu Jun 06, 2019 4:07 am

sconemad wrote:
Tue Jun 04, 2019 8:57 am
The default settings are to allow access to anyone in the sudo group. Is this how you enabled sudo access for your user (or did you add the user to /etc/sudoers)?

Alternatively, you can set the VNC permissions to allow your user directly. The file you need to edit is /root/.vnc/config.d/vncserver-x11 and
you'll need to add (or edit) the "Permissions" line, as described here:
https://www.realvnc.com/en/connect/docs ... ermissions

Something like this should do it:

Code: Select all

Permissions=user:f
Where user is your username, and 'f' means full permissions.
I just added the user to /etc/sudoers. I did some research and did this

Code: Select all

usermod -aG sudo <username>
Anyway, when connecting I receive this message "Cannot currently show the desktop". I already added

Code: Select all

Permissions=<username>:f
to

Code: Select all

/root/.vnc/config.d/vncserver-x11

User avatar
sconemad
Posts: 228
Joined: Thu Apr 28, 2016 1:47 pm
Location: Cambridge, UK
Contact: Website

Re: [VNC] Enable access for new user?

Thu Jun 06, 2019 8:58 am

a7md0 wrote:
Thu Jun 06, 2019 4:07 am
Anyway, when connecting I receive this message "Cannot currently show the desktop".
This is because VNC normally requires a desktop to be running on the console in order to provide access. You have two options here:
  • Set your Pi to boot to desktop from raspi-config by going to Boot options > Desktop/CLI > Desktop, then reboot.
  • Enable "direct capture" mode for the VNC Server, which will enable it to work without an X desktop running. To do this edit /root/.vnc/config.d/vncserver-x11 and add the line "CaptureTech=raspi", and restart the VNC Server.

Return to “Troubleshooting”