Friday, January 24, 2014

Display X app on another Linux computer with su or sudo

Imagine you have a Linux server (server) without X server installed (or running) and you need to execute some application in graphical environment. If you also have another Linux computer with X server running (laptop), then here are the steps how to do it:

Note: On server you will need this package for X authentication: xorg-x11-xauth

1) connect from laptop with GUI to the server with enabled X11 forwarding:

laptop$ ssh -X user@server_IP

2) when connecting for a firs time, notice:
/usr/bin/xauth: creating new authority file /home/user/.Xauthority

3) you can run any X application on server and you will see X output on your laptop
server$ echo $DISPLAY
localhost:10.0
server$ xclock

4) if you su or sudo to different user, you can't run X application, because you don't have /home/user/.Xauthority file with correct session details

server$ xclock

...
debug2: X11 connection uses different authentication protocol.
X11 connection rejected because of wrong authentication.
debug2: X11 rejected 1 i0/o0
debug2: channel 1: read failed
...

5) connect as normal user again and export your X session details:
laptop$ ssh -X user@server_IP
server$ xauth list
server/unix:11 MIT-MAGIC-COOKIE-1 6ead87db0aa40e02d948eb1634855706

6) now su or sudo to different user and import your session settings:
server$ xauth add <paste the list line here>


7) notice the message:
xauth: creating new authority file /root/.Xauthority

8) now you can run X application again:
server$ xclock

Reset Snare password

Based on my investigation and Snare knowledge level - the Snare Webpage password is located in registry:


You can use this script to change Snare password into: Snr12pas

@echo off
echo
echo changing snare password to Snr12pas
echo ****************
echo Please exit (ctrl+c) now if you do NOT want to go ahead!
echo ****************
pause
echo
echo making backup of existing password in registry into c:\Program Files\Snare\pass_backup.reg
echo
Reg export "HKLM\Software\InterSect Alliance\AuditService\Remote" "c:\Program Files\Snare\pass_backup.reg"
echo
echo backup done, pres enter for the password reset
pause
echo
echo resetting password
echo
reg add "HKLM\Software\InterSect Alliance\AuditService\Remote" /v AccessKeySet /t REG_SZ /d 42f0134b89d7c6f32155ac6eab2125ee /f
reg add "HKLM\Software\InterSect Alliance\AuditService\Remote" /v AccessKeySetSnare1 /t REG_SZ /d 142fd8d4998c9e9fe70e371e4aa658f8 /f
reg add "HKLM\Software\InterSect Alliance\AuditService\Remote" /v AccessKeySetSnare2 /t REG_SZ /d f6987883c4f54c235082142168b0a3db /f
reg add "HKLM\Software\InterSect Alliance\AuditService\Remote" /v AccessKeySetSnare3 /t REG_SZ /d f99d180b53b5eacd1e32ca929876417d /f
net stop snare
net start snare
echo
echo done!