0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

gtkをsudoで実行すると"can not open display"エラーで実行できない

Posted at

gtkをsudo 実行時に "can not open display" が出る場合、root 権限で起動しようとして、Xサーバへのアクセス権限がないことが原因です。

解決方法(sudo でも DISPLAY を使えるようにする)

  1. 現在のユーザーに xhost でアクセス許可を与える
    まず、通常ユーザー(root ではない)で以下を実行
xhost +SI:localuser:root

これで root ユーザーが GUI(X)にアクセスできるようになります。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?