2

How do I use a program command-line parameters with gksu?

I have a program that takes parameters.

gksu myprog --dataload --maximize

But then I get an error IBus error Folder .... owner is not root

Searching tells me I should be using gksu but then it takes the parameters for myprog as parameters for itself and says --dataload is not a command and then shows the help page.

Kinda in a loop here. So, how to use gksu and myprog or should I...

  1. Continue to use gksu and ignore the IBus error?
  2. Change ownership of the Folder to root?
1

Just quote your command:

gksu "myprog --dataload --maximize"

Alternatively, use -- which signifies the end of options. Anything after that, even if it begins with a -, will not be taken as an option to gksu:

gksu -- myprog --dataload --maximize
  • Thanks, but neither options seem to work. It goes off somewhere for about 5 seconds then returns to the Terminal-prompt. I moved the "--" to after "myprog" and it ran the program without the error, but then myprog didn't understand the "--" before it's parameters. – LinuxFerLife Jan 14 '17 at 15:43
  • No, the -- can't be after myprog, it needs to be after gksu to tell gksu not to process any other options. If you add it later, it tells myprog to ignore the options. I've tested both of these approaches and they do work. If they don't in your case, I would guess the problem is with myprog and not gksu. – terdon Jan 14 '17 at 16:10
  • Thanks for the continued help and sorry for the confusion it was my assumption and omission. I should have mentioned that was on the second try after the placement right after gksu as you showed, did the same thing. Quotes didn't work, nor did gksu -- or gksu myprog -- I even tried quotes gksu -- myprog "--data..." - all wandered off for five seconds and did nothing. – LinuxFerLife Jan 14 '17 at 16:30
  • @X10WannaBe then it's an issue with myprog. As I said, I tried gksu firefox --new-tab "http://example.com" and it failed as you describe but both gksu 'firefox --new-tab "http://example.com"' and gksu -- firefox --new-tab "http://example.com" worked as expected. – terdon Jan 14 '17 at 16:58
  • Thanks, but it appears to be an issue with Ubuntu 14.4. gksu -- veracrypt --auto-mount favorites goes off for few seconds and does not launch veracrypt. And, the same when using quoted options plus your two Firefox examples, all fail. I'll just assign root as the owner of the Folder in question that seems to get around the error. – LinuxFerLife Jan 15 '17 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.