0

I'm trying to add a program path /usr/bin/xscreensaver-demo, to file so my screensaver will start at boot. But I can't save it. I don't have the permission to change it and save it. I have tried this in both Brackets and gedit.

/etc/rc.local:

# By default this script does nothing
/usr/bin/xscreensaver-demo
exit 0

I thought of using a sudo command in the terminal but I don't know what command to execute to edit that file with superuser privilege and save it.

David Foerster
  • 35,754
  • 55
  • 92
  • 145
Myriam Rouve
  • 3
  • 1
  • 5
  • 2
    FYI `/etc/rc.local` probably isn't going to work for a screensaver application - look at [How do I start applications automatically on login?](http://askubuntu.com/questions/48321/how-do-i-start-applications-automatically-on-login) instead – steeldriver Sep 23 '16 at 13:04
  • This worked for me in a very simpler way thanks. – Myriam Rouve Sep 24 '16 at 13:52

1 Answers1

0

First you'll need a text editor. Ubuntu comes with gedit by default. To run gedit with sudo privileges type sudo gedit filepath . Then you'll be asked for your sudo password, enter it and gedit window will open allowing you to edit and save the file.

If you know how to use vi/vim (even knowing how to insert/save and quit is enough) you can do the same by sudo vi filepath This opens the file in your terminal.

Seems that i'm pretty wrong here.

Courtesy of @steeldriver Why should users never use normal sudo to start graphical applications?

@GTRONICK says > For gtk applications you should use gksudo .

  • 2
    [Why should users never use normal sudo to start graphical applications?](http://askubuntu.com/questions/270006/why-should-users-never-use-normal-sudo-to-start-graphical-applications) – steeldriver Sep 23 '16 at 13:05
  • For gtk applications you should use `gksudo`. – GTRONICK Sep 23 '16 at 13:08