109

I have always recommended pressing ALT+F2 and typing for example gksu nautilus or gksudo nautilus both are equivalent; to run graphical programs with root privileges. However, I have just installed raring on a test system and this no longer works.

gksu and gksudo are not installed as part of a default raring install; though they are in the repositories. In 12.04 at least gksudo was just a symbolic link to gksu

The reasons I have always done this are because while it is often safe to use sudo under some circumstances it can cause problems with graphical applications because gksu has you running the program as root while with sudo you are running as yourself but with elevated privileges.

This can mean you inadvertently change the owner of critical system files. This can cause problems.

This reasoning is explained better here:

Why was command removed from a fresh install and what should we be using instead?

7
  • 1
    See gksudo missing in Ubuntu forum.
    – user68186
    Apr 22, 2013 at 19:58
  • 5
    As a clarification, gksudo and gksu are not identical, even though one is a symbolic link to another (the program detects how it was initiated). There is a subtle difference that, in rare cases, can lead to the loss of selected system files. Therefore, until you start to use pkexec, please always use gksudo instead of gksu. Apr 30, 2013 at 10:07
  • 1
    @PaddyLandau I like many others here always 'gksu` and gksudo were the same see What is the difference between gksudo and gksu?. Can you add an answer to that question that explains the difference please; or give us a link to a website that explains it so one of us can. Apr 30, 2013 at 10:17
  • 4
    Worth noticing that none of the answers so far explain why gksu is no longer installed by default, which is the actual question.
    – MestreLion
    May 21, 2013 at 0:12
  • 3
    @MestreLion. The reason gksu stopped being installed by default is that the developers think polkit is a better way to control privileges. So they have been gradually migrating applications to use that instead. gksu was only part of the default install because other applications depended on it. Since nothing in a default install depends on gksu or gksudo its no longer pulled in as a dependency. Jun 19, 2013 at 15:30

2 Answers 2

71

After a long discussion on #ubuntu-devel I now understand the thinking.

gksu can be installed on 13.04 with sudo apt-get install gksu and it will work.

If you decided to install gksu and are using the 64-bit version you'll need to run gksu-properties once to set the authentication to sudo. There is no need to do this on 32-bit as it's set to sudo by default.

However gksu is not recommended any more and it may be removed entirely from future issues of Ubuntu. In general the development team would prefer us not to use GUI applications as root but to use sudo and the command line instead.

In the long term pkexec is preferred however it's not very easy to use at the moment.

pkexec allows an authorized user to execute PROGRAM as another user. If username is not specified, then the program will be executed as the administrative super user, root.

see the man page man pkexec for more information.

In the mean time you can open a terminal CTRL+ALT+T or search for terminal in dash.

Do not close the terminal until you have finished this is important as the GUI program is a child of the terminal and if you close it the GUI program will also close.

Enter sudo -i

You are now logged on as root so can make the changes you want for example

gedit path_to_file 

to edit a configuration file, or

nautilus 

to run the file manager

When you are finished close the GUI application then in the terminal

exit

You can now close the terminal.

19
  • 60
    Telling users to use the command line instead of running graphical applications as root isn't going to go over well with Windows converts...
    – Seth
    Apr 29, 2013 at 20:19
  • 4
    @seth what, they've got dos and powershell now, right? Welcome to the retro-futuristic future, now with more cli.
    – belacqua
    May 1, 2013 at 17:46
  • 5
    By the way, you can void the "closing the terminal kills all spawned programs" issue by launching the program with the & suffix so that it runs as a background process and then issuing disown %1 in bash -- or whatever job number the program is. Then you can safely close the terminal. So, it could be something like: sudo my-program &;disown %1;exit;
    – Chuck R
    May 18, 2013 at 22:45
  • 18
    However gksu is not recommended any more and it may be removed entirely.... Care to elaborate on why?
    – MestreLion
    May 21, 2013 at 0:14
  • 3
    More on windows, using it is just... Slow. Everything about it is slow. The way you do things, the poor excuse for a terminal, installing software, booting and shutting down, removing software, typing commands, attempting to shell script, a task that I can get done within 5 seconds on Linux can take me up to 10 minutes on windows. Inefficient is an understatement. The fact that I feel like I have more control in os x, or in my Android phone, really says something about the design choices of windows. Jun 17, 2015 at 17:06
9

I just installed 13.04 : GKSU is already installed...

3
  • i have just checked .....its installed .......
    – Qasim
    May 1, 2013 at 23:40
  • 1
    I was going to make a command about this answer but took a second to check if gksu was there. It is. I even installed a fresh 13.04 64 bit and it was also there. May 2, 2013 at 1:14
  • 1
    I've just checked again on my system. Still not there see these threads on Ubuntu Forums here and here. Perhaps it has been added to a recent update, or is it possible you have bought it in by installing something else? May 2, 2013 at 5:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .