Archive for August, 2008

X11 forwarding on SSH after su

before you become su,get your MIT-MAGIC-Cookie

xauth list $DISPLAY

you’ll see an output like
myhost.mydomain:21 mit-magic-cookie-1 4d22408a71a55b41ccd1657d377923ae

switch to root (’su’)

add your cookie to the session
xauth add myhost.mydomain:21 mit-magic-cookie-1 4d22408a71a55b41ccd1657d377923ae

that’s it, now you can start your forwarded X11-Application

sometimes you have to set your $DISPLAY variable,so copy the value from ‘echo $DISPLAY’ before su and set export $DISPLAY=”myhost:XY” when you’re root

The find fiasco

If you want to be sure you don’t delete files you wanted to keep (like root-directory)

never use: find /my/directory * -mindepth 1 -exec  rm -r {} \;  (VERY  BAD)

if it doesn’t find any files in your given path it will try to delete the filenames expanded by ‘*’ AFTER your given path

better use: find /my/directory -name ‘*’ -mindepth 1 -exec  rm -r {} \;