| Summary: | tdebase: Using konsole as root is hard-coded to sudo | ||
|---|---|---|---|
| Product: | TDE | Reporter: | Darrell <darrella> |
| Component: | tdebase | Assignee: | Timothy Pearson <kb9vqf> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | alexispm_stellaluna, bugwatch, darrella, dzfixes-box1, keithwdaniels, slavek.banko |
| Priority: | P1 | ||
| Version: | R14.0.0 [Trinity] | ||
| Hardware: | Other | ||
| OS: | Other | ||
| Compiler Version: | TDE Version String: | ||
| Application Version: | Application Name: | konsole | |
| Bug Depends on: | |||
| Bug Blocks: | 1700 | ||
| Attachments: |
Patch to fix sudo test in konsole.cpp
Patch to demonstrate problem in su.desktop and sumc.desktop Patch to fix konsole files with sudo or su Fix konsole files with sudo or su (1) Fix konsole files with sudo or su: updated to include missing dash in sumc.desktop Fix konsole files with sudo or su: updated to include new CMakeLists.txt option Fix konsole super user sessions with sudo or su (5) |
||
|
Description
Darrell
2012-02-11 14:33:38 CST
Created attachment 348 [details]
Patch to fix sudo test in konsole.cpp
Currently konsole.cpp tests only for "sudo su -c," which will fail on distros not restricted to sudo. This patch tests for "su-c" as well.
Created attachment 349 [details]
Patch to demonstrate problem in su.desktop and sumc.desktop
This patch likely will be rejected because the patch will break 'buntu type distros that restrict root access through sudo. I'm submitting the patch anyway to show how the desktop files should look on non restricted distros.
I don't know how we should address this problem to work with both types of distros. Possibly the cmake process can be coded to create the correct desktop files on-the-fly?
I also changed the schema. The yellow background makes colored text difficult to read. Even if the patch is rejected, please consider retaining the schema changes. :)
Noticed a long time back on my Debian systems. Here,those menu entries get removed altogether. Without them, to simply type "su" (or sudo, if used) in a user konsole does not make TDE any less functional. *** Bug 1228 has been marked as a duplicate of this bug. *** Darrell, thank you for pointing. This bug persist in 3.5.13.1 (Slavek repo: deb http://ppa.quickbuild.pearsoncomputing.net/slavek-banko/axis/ubuntu squeeze main) Perhaps a solution is to create a new sudo.desktop and sudomc.desktop and modify konsole.cpp to use the correct desktop files?
if (exec.startsWith("su -c \'")) {
exec = exec.mid(7,exec.length()-8);
else if (exec.startsWith("sudo su -c \'")) {
exec = exec.mid(12,exec.length()-13);
}
Created attachment 1602 [details]
Patch to fix konsole files with sudo or su
I am attaching a proposed patch that hopefully resolves the problem.
The patch updates konsole.cpp to check for 'su -c' as well as 'sudo su -c'.
The patch updates the su.desktop and sumc.desktop files during the cmake configuration depending upon the value of the cmake configuration variable WITH_SUDO_TDESU_BACKEND.
Created attachment 1614 [details]
Fix konsole files with sudo or su (1)
Modify files in place the sources should not be done. Therefore I prepared equivalent patch that makes change in the build folder.
Your idea for patch for me seems good. However, there is one key question for Ubuntu builds: Even on Ubuntu are in fact tdelibs and tdebase built with WITH_SUDO_TDESU_BACKEND="OFF" (see tde-packaging).
Okay, so your patch achieves the same end result and is the preferred method. Thank you. Regarding using WITH_SUDO_TDESU_BACKEND as the foundational test, I was unaware that Ubuntu and derivatives configured that option to OFF. Seems then we need a different test or we need to create a new configuration option? I don't have any patches, but I do have a work around until someone can figure out how to fix this.
This problem prevents using any scripts that may be located in /root/bin and prevents you from calling other programs (like konsole) while using "sudo konqueror" among other things. A serious problem for me.
The basic problem is that you do not have the root user's paths available, especially /root/bin and $TDEHOME is not specified in the environment.
My work around is this:
In the root directory create the file .bash_aliases
In that file insert these two lines:
PATH="{INSERT THE NECESSARY ROOT AND TDE PATHS HERE}"
TDEHOME="/root/.trinity"
Then create icons in your TDE panel for the apps that you want to run with supper user permissions, and environments.
Examples of the commands you would use if you right click the icon, and select the Configure XXXX Button choice. Then click on the Application tab and add the command you want to run in the, Command: [---text box area---].
-----------------
tdesu -u root -c "kate --config /root/.trinity/share/config/katerc --caption ROOT %U"
tdesu -u root -c "konsole --config /root/.trinity/share/config/konsolerc --caption ROOT"
tdesu -u root -c "konqueror --profile filemanagement --config /root/.trinity/share/config/konquerorrc --caption ROOT"
-----------------
and everything works from startup. Including being able to open other programs from Konsole and Konqueror and in Kate you have a "real" root terminal window available.
I like my apps to have ROOT in the title bar so that when they are minimized I can tell which app is a root app, I also us a different colored background in the program. I don't know if the --config option is necessary, it was in there when I started experimenting, but it is probably not necessary.
Note: This "probably" will not work unless you at least have a root user with a Xwindows environment.
Keith
Thanks for the work-around. Slavek's updated patch should resolve this particular bug report (konsole only). The patch won't resolve problems with other apps, such as kate/kwrite, as reported in bug 1700. :-( Slavek, your updated patch works well here. To resolve this report we need to (again) update the patch with a different test or we need to create a new configuration option other than WITH_SUDO_TDESU_BACKEND? I would like to make one change to the current patch. In sumc.desktop.cmake: AS IS: Exec=@KONSOLE_SUPER_USER_COMMAND@ -c 'mc -c' CHANGE TO: Exec=@KONSOLE_SUPER_USER_COMMAND@ - -c 'mc -c' Without the extra dash sumc opens to the user's $HOME rather than root's. BTW, the missing dash was inherited that way from KDE3, but resolving this bug report should agree with bug 1700 as well. Created attachment 1645 [details]
Fix konsole files with sudo or su: updated to include missing dash in sumc.desktop
Created attachment 1655 [details]
Fix konsole files with sudo or su: updated to include new CMakeLists.txt option
Slavek,
I updated the patch with a new CMakeLists.txt option:
WITH_SUDO_KONSOLE_SUPER_USER_COMMAND
The default is OFF.
The patch works here with both ON and OFF.
Several non-Ubuntu users are affected by this problem. Hopefully we can push this into git soon.
Created attachment 1656 [details]
Fix konsole super user sessions with sudo or su (5)
Thank you for the update patch.
But I noticed one contradiction. The in konsole/konsole/konsole.cpp is tested "su -c \'" and "sudo su -c \'", but now it does not match at all.
So I modified the patch - for greater variability in comparison is used regular expression - just single line.
Please, test it.
Note: All your recent changes are also incorporated. I have slightly modified description of new build option, because this is not related to tdesu. In the last update you inadvertently changed WITH_SUDO_TDESU_BACKEND option also in tdesu.
I noticed a typo: luanching × launching => I have it already fixed. Okay, thanks. :-) BTW, grep the tdebase sources and notice WITH_SUDO_TDESU_BACKEND is not used anywhere. So perhaps this latest patch was not needed? That is, we could use WITH_SUDO_TDESU_BACKEND as the criterion? (Odpověď na komentář #20)
> Okay, thanks. :-)
>
> BTW, grep the tdebase sources and notice WITH_SUDO_TDESU_BACKEND is not used
> anywhere. So perhaps this latest patch was not needed? That is, we could use
> WITH_SUDO_TDESU_BACKEND as the criterion?
WITH_SUDO_TDESU_BACKEND is used in "tdesu/CMakeLists.txt". And it's a legitimate use. Your previous patch it incorrectly replaced to WITH_SUDO_KONSOLE_SUPER_USER_COMMAND :)
Sigh. :-( You're correct. I'm sorry. Slavek, the patch is functioning here. I don't use sudo and the su and sumc desktop files configured correctly. With respect to sudo, I tested as far as letting cmake complete the configuration and then I inspected the respective desktop files. Great work! I say we can put this to rest. Push the patch. :-) Pushed to GIT in hash 7d6186b5. |