Saturday, August 11, 2018

sudo - Make gksu ask for password in terminal



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?



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.


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 (...