Skip to content

Instantly share code, notes, and snippets.

@cmdcolin
Created January 28, 2016 20:44
Show Gist options
  • Select an option

  • Save cmdcolin/f0e45122f85b3515f0f3 to your computer and use it in GitHub Desktop.

Select an option

Save cmdcolin/f0e45122f85b3515f0f3 to your computer and use it in GitHub Desktop.
X11 as sudo
#!/bin/bash
# usage: x11sudo.sh username
su - $1 -c 'xauth list' | grep `echo $DISPLAY | cut -d ':' -f 2| cut -d '.' -f 1 | sed -e 's/^/:/'`|xargs -n 3 xauth add
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment