Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

With the coming 14.04 release sux (wrapper around su which will transfer your X credentials) is no longer included in Ubuntu. (I think it is being removed because it is being pulled from Debian, because of no maintenance of the original code.)

I'm looking for simple alternatives, not something that requires you to mess around with config-files or run sshd locally.

share|improve this question
    
Reviewers: This is not off-topic, it has nothing to do with 14.04. –  Seth Mar 3 at 5:03
    
Do you really need this? If your sudoers options are setup just so (i.e. so that sudo preserves HOME when changing identities), it should not be necessary to do anything special with .Xauthority. That's how my laptop is configured, and I never use sux... just 'sudo {command}' –  Stabledog Mar 3 at 6:30
    
@Stabledog how would that work? Where would I set that up? Is there a sudo config file? My goal is to log in to the desktop of user A, and then get a terminal as user B, where all x is going through to the desktop. Hope that makes sence... Example of what I could do now with sux, that I need alternatives for: User A logs in and opens terminal A@desktop:~$ sux - B B@desktop:~$ firefox Firefox opens, but with user B's settings, bookmarks and file acces to user B's home directory. –  soeren-b-c Mar 4 at 7:12
    
Yeah, I do that sort of thing all the time. There are 2 things to understand: ~/.Xauthority for the "outer" user needs to become the .Xauthority for the inner user too, and the DISPLAY variable setup by ssh needs to match in the inner shell. So you could, for example, copy the ~/.Xauthority file from '/home/tom' to /home/jerry, fixup the permissions, set the DISPLAY value in the 'jerry' shell. When launching an X program as jerry, the DISPLAY value would tell the X libs how to find the display, and the .Xauthority file in /home/jerry would give it the auth data. –  Stabledog Mar 5 at 2:52
    
But that's messy to do on each login. It's cleaner to fixup your /etc/sudoers so that the HOME and DISPLAY values of tom are preserved when he does a 'sudo -u jerry bash' to open a shell as jerry. There are comments in sudoers which explain how to propagate environment variables across a sudo call. Be sure to use visudo when editing sudeors so you don't lock yourself out of the machine if you screw up! –  Stabledog Mar 5 at 2:54

1 Answer 1

up vote 4 down vote accepted

I've been very sad too to see that there were no easy alternative to sux at first, but ended with this :

  • in /etc/pam.d/su, to forward xauth keys between users when calling su, add : session optional pam_xauth.so

  • in ~olivier/.bashrc : export $(dbus-launch) (not sure it is actually needed)

  • and then a simple su olivier from my logged-in user
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.