mugurdi
Posts: 68
Joined: Tue Oct 14, 2014 3:49 am

I can not edit 'rc.local' with leafpad text editor

Mon Feb 05, 2018 3:47 pm

Hello,
The nano editor seems uncomfortable. How can I edit files like "rc.local" with a friendlier text editor?
Last edited by mugurdi on Tue Feb 06, 2018 4:23 am, edited 1 time in total.

User avatar
PeterO
Posts: 5958
Joined: Sun Jul 22, 2012 4:14 pm

Re: I can not edit 'rc.local' with text editor

Mon Feb 05, 2018 3:59 pm

Please change the title as it is misleading. You are asking about choice of editors, not about problems with editing rc.local.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
bensimmo
Posts: 4726
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: I can not edit 'rc.local' with text editor

Mon Feb 05, 2018 4:02 pm

If you are using the desktop
use
sudo leafpad /etc/rc.local
in a terminal window

switch leafpad to any other text editor you want to use.

I always use leafpad over nano unless I'm not in the desktop.

mugurdi
Posts: 68
Joined: Tue Oct 14, 2014 3:49 am

Re: I can not edit 'rc.local' with leafpad text editor

Tue Feb 06, 2018 4:23 am

Hello,
My question was not entirely accurate: I am connected to RPi from my Mint PC with a VNC interface (tigthvnc-jviewer) and when I tray to use leafpad, I get this error:

Code: Select all

pi@raspberrypi:~ $ sudo leafpad /etc/rc.local
Client is not authorized to connect to Serverleafpad: Cannot open display: 

n67
Posts: 938
Joined: Mon Oct 30, 2017 4:55 pm

Re: I can not edit 'rc.local' with leafpad text editor

Tue Feb 06, 2018 4:38 am

The title is fine. The question is really about "How do I run a GUI app on the X desktop with sudo privs?"

The answer is "gksudo".

I just did this, from a "Terminal" window running on the desktop (Terminal running as user 'pi', as usual):

$ gksudo leafpad /etc/rc.local

It brings up the leafpad editor as expected. It also brings up a window warning me about "Granting permissions without asking for password".
"L'enfer, c'est les autres"

G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:

Epmu Sn!

J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!

mugurdi
Posts: 68
Joined: Tue Oct 14, 2014 3:49 am

Re: I can not edit 'rc.local' with leafpad text editor

Tue Feb 06, 2018 6:29 am

Thanks!

Code: Select all

$ gksudo leafpad /etc/rc.local
works well

User avatar
bensimmo
Posts: 4726
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: I can not edit 'rc.local' with leafpad text editor

Tue Feb 06, 2018 7:59 am

n67 wrote:
Tue Feb 06, 2018 4:38 am
The title is fine. The question is really about "How do I run a GUI app on the X desktop with sudo privs?"

The answer is "gksudo".

I just did this, from a "Terminal" window running on the desktop (Terminal running as user 'pi', as usual):

$ gksudo leafpad /etc/rc.local

It brings up the leafpad editor as expected. It also brings up a window warning me about "Granting permissions without asking for password".
For the info, the title had changed.

Return to “General discussion”