martedì 12 gennaio 2021

export DISPLAY after sudo and impersonating another user


Very useful!

The following article teaches how to use xauth add

https://www.thegeekdiary.com/how-to-set-x11-forwarding-export-remote-display-for-users-who-switch-accounts-using-sudo/

" if you try to switch to another user on the remote system and export the display again, you would get and error – “Error: Can’t open display:”.

# ssh -X root@remotehost
# su - [username]
# export DISPLAY=x.x.x.x:y.y 
# xclock 

Error: Can't open display: x.x.x.x:y.y

"