0

If I needed to run a graphical command as root, I would use:

username@HENRY-PC:~$ sudo gedit
[sudo] password for username: 

But this is apparently discouraged, because any files created for the X-server in my home folder, would be owned by root. It is recommended that I use gksu. My problem is that when I use gksu, it freezes my display, opens a overlay, then asks for my password. This interrupts me while multitasking.

According to this: askubuntu.com/questions/11760, the configuration files will be saved as root in my home directory, this is what I don't want, and gksu will set the home directory to root, so the configuration files will be saved there. I know any files that I create will be saved as root.

How would I change gksu to ask for password in the commandline instead?

Henry
  • 342
  • 1
  • 11
  • You effectively don't. If you need to run it from root, you can, and then run a sudo chown later to change file ownership. gksu operates under the same logic as sudo does, as well, in that anything 'created' by the application will be done as the superuser root. – Thomas Ward Mar 29 '15 at 01:02
  • According to this: askubuntu.com/questions/11760, the configurations files will be saved as root. I know that the created files will be saved a root, but how would I prevent the configurations files from being saved as root. – Henry Mar 29 '15 at 02:13

1 Answers1

0

You can use sudo -H gedit instead. From man sudo:

 -H, --set-home
             Request that the security policy set the HOME environment
             variable to the home directory specified by the target user's
             password database entry.  Depending on the policy, this may
             be the default behavior.

AFAIK this request is honored on modern Ubuntu systems, and should have the same effect as gksudo or gksu.

steeldriver
  • 136,215
  • 21
  • 243
  • 336