login about faq

To access root account, our system requires us to log in as an unprivileged user and then "su" to root. I use the command "su - root". The problem is that X11 forwarding stops working when I do the "su". How can I make it work?

asked Dec 21 '10 at 16:44

SSH%20KB's gravatar image

SSH KB ♦
509249246237


If login to the UNIX host has to be done as a non-privileged user and then by su-ing to root, there will be problems with X authorization. Once X11 forwarding works for the non-privileged user, it is possible to set the same $XAUTHORITY and secure shell connection specific $DISPLAY for the root.

Perform the following steps on the SSH Tectia Server side:

  1. Check the $DISPLAY variable of the non-privileged user:

    echo $DISPLAY
    SSH_SERVER_IP:10.0

  2. su to root

    su - root
    Password:

  3. By default xauth will look into the user's home directory for the .Xauthority file. Change or create the $XAUTHORITY variable to point to the .Xauthority file of the non-privileged user. For example in zsh or bash:
    export XAUTHORITY=/home/user/.Xauthority
  4. Change or create the $DISPLAY variable to match the $DISPLAY of the non-privileged user. For example in zsh or bash:
    export DISPLAY=SSH_SERVER_IP:10.0

In case the environment is not reset for root (su root), you will not have to export the $DISPLAY variable as it remains the same.

link

answered Dec 21 '10 at 16:50

SSH%20KB's gravatar image

SSH KB ♦
509249246237

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×4

Asked: Dec 21 '10 at 16:44

Seen: 16,697 times

Last updated: Dec 21 '10 at 16:50

All user contributed content licensed under the cc-by-sa license.
Powered by OSQA.