не удается открыть файл в gedit из терминала, когда я вхожу в систему как root

5003
Suhail Gupta

Когда я пытаюсь открыть файл с именем tester.phpиз gedit, войдя в систему как root, я вижу это:

[root@Feddy htdocs]# gedit tester.php  (gedit:4310): EggSMClient-WARNING **: Failed to connect to the session manager: None of the authentication protocols specified are supported   ** (gedit:4310): WARNING **: Could not connect to session bus 

Что это за сообщение и почему я получаю это?

ПРИМЕЧАНИЕ: я могу открыть файл по той же команде

gedit tester.php 

когда я действую как обычный пользователь. (т.е. не root)

0

1 ответ на вопрос

2
WeloSefer

By default, and for security reasons, the only user that interacts with X-server is the logged-in user. Meaning, You can not initiate a connection to x-server as a different user or in your case as root, unless you have overridden the default setting to allow different users/hosts to connect to x-server. So the error message you are getting is related to x-server since any other user can't connect to it. In order to get around it, you have various fixes you can apply. What I normally do when ever I need to run an X-app as root is as follows.

  • From normal user terminal, I run xhost + to grant access to all user temporarily
  • Then I log in as root from a different terminal and execute the X-app ie gedit tester.php

To make it permanent (which I don't suggest), edit /etc/profile and add the following line:

export XAUTHORITY=/root/.Xauthority 
То же сообщение .. [Вот снимок того, что я сделал] (http://oi50.tinypic.com/ft7df.jpg) Suhail Gupta 11 лет назад 0
вместо `su` делай` su -` WeloSefer 11 лет назад 0
да, это сработало! Спасибо. Подскажите, пожалуйста, разницу между `su` и` su -` Suhail Gupta 11 лет назад 0
также есть ли время, пока я не смогу открыть файл непосредственно из терминала от имени пользователя root? Suhail Gupta 11 лет назад 0
Использование дефиса "-" заставляет новое подключение оболочки работать с настройкой переменных среды и всеми настройками по умолчанию в соответствии с предпочтениями пользователя. WeloSefer 11 лет назад 0
до тех пор, пока вы не отключите доступ, вызвав `xhost -` из приглашения обычного пользователя и не перезапустив, он все равно должен работать WeloSefer 11 лет назад 0

Похожие вопросы