2

I have a simple scenario to demonstrate the use-case for this question

  1. Login to Linux as currentuser
  2. start bash terminal
  3. xauth list $DISPLAY
    • mint/unix:0 MIT-MAGIC-COOKIE-1 7b00a8e53b8d9e579c2eaf5009561fa4
  4. change user name
    • su -- otheruser
  5. xauth add mint/unix:0 MIT-MAGIC-COOKIE-1 7b00a8e53b8d9e579c2eaf5009561fa4
  6. xeyes

Anyway that's the plan. The reality is that I'm getting a time-out error on the xauth add command

xauth:  timeout in locking authority file /home/currentuser/.Xauthority

... because it is looking at currentuser. So I haven't been able achieve the objective, to run xeyes using the otheruser login.

Is there a way to actually login as the otheruser account? Or is the notion off-track in the first place?


similar/related questions:

1 Answer 1

0

I have been doing more reading and testing. I have a solution, if not a complete explanation.

  1. Login to Linux as currentuser
  2. start bash terminal
  3. xauth list $DISPLAY
    • mint/unix:0 MIT-MAGIC-COOKIE-1 7b00a8e53b8d9e579c2eaf5009561fa4
  4. change user name
    • su -otheruser
  5. XAUTHORITY=/home/otheruser/.Xauthority
  6. xauth add mint/unix:0 MIT-MAGIC-COOKIE-1 7b00a8e53b8d9e579c2eaf5009561fa4
  7. xeyes

The two big differences are steps #4 and #5. Looking at the su man page reveals:

If --login is used, the $TERM, $COLORTERM, $DISPLAY, and $XAUTHORITY environment variables are copied if they were set.

I'll be honest I only found (the import of) that piece of information after I got the xeyes to work. So the first thing to be done is to use

  • su-otheruser

Using the single dash, means the environment is set by scripts, and Not copied from the currentuser. By default the .Xauthority file protection is set as owner-only access:

  • -rw------- 1currentuser currentuser54 Dec 26 23:21**.Xauthority**

So when the XAUTHORITY points to the currnetuser's file, there is a File Open failure. Thus the second change:

  • XAUTHORITY=/home/otheruser/.Xauthority

    Recall, this is one of the environment variables copied with the su command.

I suspect that the only the second change is necessary, for my use I wanted a 'good' logon to otheruser, as-if he/she logged on to the Desktop or via ssh.

Final point of advantage; since the DISPLAY variable is also copied, you don't need to set and export DISPLAY which would be needed with a loop-back using ssh.

progressing

Any every time you login with su; the first step is to set the XAUTHORITY environment variable to point to the local

  • ~/.Xauthority

file.

In the end, it was the environment variable: XAUTHORITY pointing to the *currentuser* that made things not work. Hope the next person find they've saved a heap of time!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .