“xdg_runtime_dir not set in the environment” and pkexec doesn't work

北慕城南 提交于 2019-12-06 04:25:52

I have faced similar issues when using gedit after i ssh into any other user.This may be due to missing permission.

Try the following :-

Open a new terminal from your current user. type in

sudo -i

This prompts for root password. Enter that and then you will be in able to access using root privilege.

Then Try Gedit the file you want to edit. If you need to do it using su for other user then after the above step, do

su <username>

Now Try gedit any file. Works for me.

crisron

Run the following command:

pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY gedit /usr/local/svn/passwd-team

Enter your user account password in the password field.

Explanation:

When you run gedit as another user (in this case root) you're in fact starting the new minimal and isolated environment that doesn't carry on some "excessive" variables (among others variables responsible for injecting libraries or setting certain privileges). The command above causes to carry on user-specific X-server settings from the current session.

References:

  1. https://askubuntu.com/a/467994/185132
Adrián Castillo

I had the same problem. In my case I ran command below:

sudo visudo

In the file that opens I deleted the last line (env=http...) and I saved the file. Then everything worked as usual.

Your explanation shows that you did not run the command with root privileges as the message appeared "Authenticating is needed to run '/usr/bin/env' as the super user"

Try to run it as

sudo pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY gedit

Then the screen asks for root password, type your password and you should be fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!