3

In the old days of CentOS 5 i had an application that run as another user. I created a .desktop file which run a command that looked like this:

gksu -u anotheruser someapplication

When the user clicked the icon a popup asked for the password of "anotheruser" and when the password was correct "someapplication" started.

Now in the modern days of CentOS 7 i can't find a replacment for this behaviour. I tried beesu:

beesu -l -P someapplication anotheruser

but it is asking me for the root password instead of "anotheruser" password.

I also tried pkexec:

pkexec --user anotheruser someapplication

With the same result.

Both methods also have problems finding the correct display variable:

Failed to parse arguments: Cannot open display:

Any help will be appreciated.

Thank you.

  • I have seen this question, but i still have the first part of the problem. How to run as nonroot user without typing the root password. I don't want to give the root password to the user. – user1403360 Nov 30 '15 at 13:14
  • Further explanation: Let's say i have 3 users on the machine: user1, user2 and root. I want that user1 has the possibility to run an application as user2. When he clicks the icon user1 should be asked for the password of user2 and not the password of user1 or root. – user1403360 Dec 1 '15 at 7:13
  • Now i found kdesu which for now seems to be a drop-in replacment for gksu – user1403360 May 20 '16 at 12:50
  • Try pkexec which will promote you native polkit agent to authenticate – 炸鱼薯条德里克 Sep 12 at 12:04
0

Try using sudo with an alternate user and root password in a terminal:

sudo -u USER COMMAND

If the display works correctly, you can setup sudo (in the sudoers file via visudo) to use the target user's password:

targetpw If set, sudo will prompt for the password of the user specified by the -u option (defaults to root) instead of the password of the invoking user when running a command or editing a file.

From there just build the command to launch with in an xterm.

I just remembered, I used gksudo briefly when first trying Ubuntu, is that maybe what you are thinking of?

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.