User avatar
mad-hatter
Posts: 419
Joined: Sun Feb 26, 2012 2:58 pm
Location: By the UK seaside

TightVNC and sudo privileges

Sun Feb 10, 2013 3:16 pm

Hello,

Trying to run a programme on the Pi from my win 7 machine using tightvnc,
no problems with tightvnc, works fine.

The programme I'm trying to run needs root privileges or sudo.

I can run the programme on the Pi with no problems from a root or LX terminal.

If I log in from my win 7 machine and run the programme from a root terminal its fine,
if I try sudo ./myprog from an LX terminal,

I get the following error:-

pi@mypi ~/qt4/io1 $ sudo ./io1
Client is not authorized to connect to Serverio1: cannot connect to X server :1
pi@mypi ~/qt4/io1 $

Is this a privilege problem, is there a way to run this programme from
my win 7 machine as a normal user using sudo ./myprog.

Thanks for any help offered.

Regards

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5590
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: TightVNC and sudo privileges

Tue Mar 05, 2013 7:18 pm

Although I've noted similar issues with trying to run "synaptic", which requires privileged user authorisation, via tightvnc, "sudo blah ..." has usually worked. How do you establish your VNC connection? - I mainly login via a PuTTY ssh (secure shell) with X11 and port forwarding enabled (example screenshots at http://www.cpmspectrepi.webspace.virgin ... aspPi.html , more info. on this approach can be found in the wiki). Does your (unnamed) program really require root privileges? Some tools really only require the user to be a member of a specific group eg. CUPS - lpadmin, i2c-tools - i2c. Whilst user pi is already a member of a number of groups - use the "id" command to see them, a new user will not be - eg. use "sudo adduser fred lpadmin" to add the (existing) user "fred" to the group "lpadmin". Hope this is of some help.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
mad-hatter
Posts: 419
Joined: Sun Feb 26, 2012 2:58 pm
Location: By the UK seaside

Re: TightVNC and sudo privileges

Tue Mar 05, 2013 8:22 pm

Hello FTrevorGowen ,

Thanks for the reply.

I'm using TightVNC, and connecting to the PI with the LDXE desktop running.
This way I can use the normal Pi menu and get a root terminal.
Pi access.jpg
Pi access.jpg (14.5 KiB) Viewed 1887 times
I'm also using MobaXterm_Personal_6.1 set up as Pi, root or user.
Again I can boot direct to the desktop and use the Pi menu
or to root, this gives me full control. In a normal terminal, sudo works
as expected.

Yes, I need root privileges to run programs using bcm2835, gpfsel_list and other
programs, that access the GPIO low level functions.

Regards

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5590
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: TightVNC and sudo privileges

Tue Mar 05, 2013 8:58 pm

I've only just started playing with GPIO stuff myself - mainly via "i2c-tools" and/or Gordon D.'s "WiringPi" 'C' libraries, neither of which require root privileges. Historically I have more experience with Red Hat/Fedora Linux than Debian (although my netbook is dual-boot XP/Ubuntu). Before I retired, I used PuTTY to remotely login and work on code running on a Fedora based HP cluster but, again, that was "high-level" (Mixed 'C' & Fortran) stuff. Because I have several Pi's, but only one HDMI/DVI monitor I tend to just use PuTTY and rely on X-forwarding. One possibility has occurred to me though - whilst it's not usual for root on a Pi to have a password have you tried assigning one, (remotely) logging in from a PuTTY(-like) terminal shell and then invoking superuser ("su") mode rather than using "sudo". It's probably more risky but might work.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

Return to “Networking and servers”