Wednesday, October 11, 2017

gksudo - Why is gksu no longer installed by default?


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?



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.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...