LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (http://www.linuxquestions.org/questions/linux-security-4/)
-   -   su vs gksu (who is doing what to whom?) (http://www.linuxquestions.org/questions/linux-security-4/su-vs-gksu-who-is-doing-what-to-whom-4175465762/)

taylorkh 06-12-2013 03:06 PM

su vs gksu (who is doing what to whom?)
 
I was experimenting with launching an application as a different user. In this case the Calc application from LibreOffice. Why? A long story as documented in another post. That issue is history. Not resolved for other reasons but history. My experiment did bring up another question. Here is what I did on my test machine (LinuxMint 14 Mate desktop running under VMWare).

I created a new user, moe (one of the 3 stooges and my main test user :) )
I created a launcher on my (ken) desktop thusly
Quote:

gksu -u moe "libreoffice --calc %U"
When I execute the launcher a dialog comes up and says
Quote:

Enter your password to run the application 'libreoffice --calc as user moe
It requires MY (ken) password not moe's password.

If I execute su moe in a terminal I am asked for moe's password.

If I execute the launcher and then execute ps -aux in a terminal I see a libreoffice process owned by moe.

After executing su moe I find a bash proces owned by moe.

Upon reflection it occurred to me that I (ken) am a sudoer as I installed the OS with the ken account and thus its password can invoke root permissions. So I created another stooge account, larry. I logged into the machine as moe and created a Calc launcher to gksu to larry and invoke calc. This time I get an error
Quote:

Failed to run libreoffife a--calc as user larry. The underlying authorization mechanism (sudo) does not allow you to run this program.
The man page for gksu tells me
Quote:

gksu is a frontend to su and gksudo is a frontend to sudo.Their primary purpose is to run graphical commands that need root without the need to run an X terminal emulator and usingsu directly.
The -u option is supposed to
Quote:

Call <command> as the specified user.
It appears that gksu is invoking sudo rather than su or am I missing something?

TIA,

Ken

Ygrex 06-13-2013 11:06 PM

http://manpages.ubuntu.com/manpages/...n1/gksu.1.html
Quote:

Notice that all the magic is done by the underlying library, libgksu. Also notice that the library will decide if it should use su or sudo as backend using the /apps/gksu/sudo-mode gconf key, if you call the gksu command.

taylorkh 06-14-2013 07:08 AM

Thanks Ygrex, I had reviewed some man pages on gksu, perhaps not the Ubuntu one. When I read "gksu is a front end for su and gksudo is a front end for gksu"... if I swing a hammer to drive a nail I do not expect it to change into a screwdriver and install a wood screw. But to get off my soap box - I added the -w option to gksu and it executes gksu as expected. So now I know how to make it work.

Unfortunately CentOS (RHEL) does not support gksu and to make this a further moot point the "clipboard" does not properly copy spreadsheet data between two separate instances of Calc which was the origin of this whole boondoggle.

So again Ygrex my sincere thanks.

Ken


All times are GMT -5. The time now is 01:48 AM.