X11: run a gnome app as another user

后端 未结 6 1838
日久生厌
日久生厌 2021-02-01 20:35

I have ubuntu + x11 + gnome.

I want to run a graphical application as another user.

However, when I start it from the command line using sudo -u otheruser

相关标签:
6条回答
  • 2021-02-01 21:08

    You probably need to tell your X server to accept connections from another user than the one owning the server instance (you). Look into the xhost command.

    0 讨论(0)
  • 2021-02-01 21:17

    gksudo -u command

    0 讨论(0)
  • 2021-02-01 21:25

    Use

    xdg-su -u user -c command
    
    0 讨论(0)
  • 2021-02-01 21:25
    gksu -u <user> -c <command>
    

    Replace <user> with the username to run the command as, and <command> with the command you want to run. Remember that the program will be run in the <user>s context, but in the current directory.

    In the popping up window, enter the password of the target <user> of course.

    0 讨论(0)
  • 2021-02-01 21:26

    Execute this command first:

    $ sudo xhost +
    

    Then run the command you want as the other user:

    $ sudo -i -u username
    $ command you want to run
    

    When you are done:

    $ sudo xhost -
    
    0 讨论(0)
  • 2021-02-01 21:31

    xhost '+si:localuser:USERNAME'

    0 讨论(0)
提交回复
热议问题