Friday, November 25

Where has root gone?

You may of noticed you can no longer check which physical drive root is mounted on via "mount"

tim.bowers@localhost ~ $ mount
rootfs on / type rootfs (rw)
/dev/root on / type ext3 (rw,noatime,errors=continue,barrier=0,data=writeback)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
Herpa derpa!

So.... how do we now check where / is mounted? We could check fstab....

cat /etc/fstab
 ...some stuff...

/dev/sda3        /        ext3        noatime        0 1
But I'm not sure /etc/fstab is always readable.... another way is :

tim.bowers@localhost ~ $  ls -ilah /dev/root
1744 lrwxrwxrwx 1 root root 4 Oct 21 08:50 /dev/root -> sda3

Enjoy!

Sunday, November 6

Firefox changing h in address bar into w

In one of the most stupid changes ever firefox devs decided that the http:// prefix shouldn't exist, and so you shouldn't be able to type it either.

In firefox 7 if you type a h into the address bar, it presumes you don't understand you don't need the http:// prefix and instead changes your h into a w, as if you were about to type "www".... Now, I'm not even going to go into why this is broken as you need a seperate DNS record (or catch all) for the www. prefix anyway....

To turn it off this stupid behaviour :

about:config
search for 'browser.urlbar.trimURLs'
Change to false.

Done.

Note: You MAY want to see the http prefix, because if its http and not https as you were expecting, this is the first sign something may of gone wrong.

Sunday, September 4

Editing xfce4 themes

I presumed that editing gtk themes (thats what xfce4/xfwm4 uses) would be a total PITA. It wasn't. Infact it was so simple I'm concidering starting to make my own... Could be really interesting and add something back to the community.

So this is how :

cd /usr/share/themes/
# make a copy of the theme your editing - "Just in case"
cp ./Xfce4-dusk ./Xfce4-dusk-edited-by-smiley
# I use nano - you may prefer vi/ed/something else...
sudo nano -w ./Xfce4-dusk-edited-by-smiley/gtk-2.0/gtkrc

Now, for something simple like a window border you are looking for:
# This is for the window borders (xfwm4 & metacity)
#
style "titlebar"
{
    bg[SELECTED]      = "#D55C00"
    fg[SELECTED]      = "#ffffff"
    bg[INSENSITIVE]   = "#A14600"
    fg[INSENSITIVE]   = "#DC894A"
}

Where bg[SELECTED] is the hex colour code for the border of the selected window, fg[SELECTED] is the hex colour of the text of the title bar.
Simularly bg[INSENSTIVE] is the border colour of a non-selected window, which is generally a darker colour to indicate the non-active status of this and fg[INSENSTIVE] is the text colour of the title bar when that window is inactive.

Once you've edited this, simply change your theme via the appearance settings of your window manage/desktop enviroment - for Xfce4 this is via settings -> appearance. Select your new theme and happy days :)

## WARNING - I'm not sure what'd happen if you edit themes in place while being used. They may update the wm "live" or it might explode in your face. :)

Monday, August 8

Getting ssh-agent to play nice

Want ssh agent to play nicely?

Simples!

nano -w ~/.bashrc

Add this to the end

ssh-agent -t 1d
eval `keychain --eval --agents ssh id_dsa`


----

What are we doing? Loading ssh-agent with 1 day time out - adjust as needed.
Load the keychain for ssh. It'll request the passphase when you start a shell :)

Thursday, May 26

Livin in an ubuntu world

I don't have much choice at work and am using ubuntu. I know of bonsaikittens hate for it, and infact I happily share this sentiment... Maybe one day I'll switch.

But for now I've noticed that I'll come in, of a morning and either Xorg or Compiz or Xscreensaver has crashed leaving me without a working login. I'll have to switch to a tty and kill it to get back to normal - not much good if I left something open I was editing previously (like the list of task I've completed this week).

Really I should try and look into why its crashing and fix that, but in the mean time I decided I wanted the same screensaver I have at home. That is phosphor running the gentoo-blogs rss feed. Much better than the stupid ubuntu blog feed which never seems to be updated!

Here goes:

tim.bowers@timbowers ~ $find / -name xscreensaver-demo
find: ‘/etc/ssl/private’: Permission denied
find: ‘/etc/phpldapadmin/templates’: Permission denied
find: ‘/etc/cups/ssl’: Permission denied
find: ‘/var/log/samba/cores’: Permission denied
find: ‘/var/log/gdm’: Permission denied
find: ‘/var/run/gdm’: Permission denied

Doh! Oh, yes its ubuntu, we like sudo for everything so...

tim.bowers@timbowers ~ $sudo find / -name xscreensaver-demo
tim.bowers@timbowers ~ $

Hum..... well I know xscreensaver is installed.... I use it and have a jumping up and down cow on my screen....

tim.bowers@timbowers ~ $sudo find / -name xscreensaver
/usr/share/xscreensaver
/usr/share/doc/libpam-ldap/examples/pam.d/xscreensaver
/usr/lib/xscreensaver

Gottya!
Next time I should just try:

tim.bowers@timbowers ~ $whereis xscreensaver
xscreensaver: /usr/lib/xscreensaver /usr/share/xscreensaver
tim.bowers@timbowers ~ $

:D

tim.bowers@timbowers ~ $/usr/lib/xscreensaver/phosphor ## Runs screensaver in a window - looks kind of epic, but completely useless ;)
^C
tim.bowers@timbowers ~ $/usr/lib/xscreensaver/phosphor --help
Phosphor: from the XScreenSaver 5.11 distribution (13-Apr-2010.)
http://www.jwz.org/xscreensaver/

Options include: -root, -window, -mono, -install, -noinstall,
-visual , -window-id , -fps, -no-fps, -pair,
-font , -scale , -ticks , -delay ,
-program , -pty, -pipe, -meta, -esc, -bs, -del.


Errrrrm.... so how do I pass a variable to be used?....


http://www.jwz.org/xscreensaver/faq.html#which-one - says....
"Run the xscreensaver-demo program: when its window comes up, one of the elements in the list of display modes will be highlighted by default. That is the one that was most recently running.

People often suggest that I put the name of the current hack on the password dialog box. I'm not going to do that, because that would be a (non-security-related) feature that was only available if locking was turned on, and most people don't lock their screens. Just launch xscreensaver-demo to see which one it was. "

Oh ok, seems sensible enough:

tim.bowers@timbowers ~ $xscreensaver-demo
The program 'xscreensaver-demo' is currently not installed. You can install it by typing:
sudo apt-get install xscreensaver


Wait.... what? - Fine... I'll install whats already installed...

tim.bowers@timbowers ~ $sudo apt-get install xscreensaver
.....waits....
Setting up xscreensaver (5.11-1ubuntu2) ...
tim.bowers@timbowers ~ $

Right... lets try that again

Yey - we have xscreensaver-demo moaning that xscreensaver daemon isn't running.... because gnome-xscreensaver-daemon is instead. Gnome? Daemon? Xscreensaver? Meh. I dont know wtf they've done but they've broken it in ways it should never of been abused!.

Sunday, May 15

Fishies!

     Bristlenose catfish
HairgrassBristlenose catfish on driftwood  P1030304P1030303
 Boris
 P1030299 P1030301

Fish, a set on Flickr.

I love it when a tank comes together!

Monday, March 14

configure: error: cannot compute suffix of object files: cannot compile

After I had some problems with a glibc and gcc updates on gentoo I found it would no longer compile my toolchain for crossdev.

i.e. crossdev -t i686 would result in error : "configure: error: cannot compute suffix of object files: cannot compile"

After random wanderings on the internets I stumbled accoss someone suggesting lddconfig to clear some cache which maybe incorrect. After trying all sorts of other fixes, it appears this one really worked!.

Hopefully this will help someone else out one day.

Gentoo Forever!

Thursday, February 17

BackupPC error 001E - Is your shell clean?

Just spent the last afternoon ripping my hair out after setting up BackupPC for a load of windows machines and having not much trouble at all, only to come and try and backup my own linux machine to meet a world of pain.

The problem is, as the program has evolved, some things seem to never have been documented. Hopefully this will help someone in the future if they ever have the same issues I've just seen.

BackupPC wouldn't connect to my system - I saw no mention of the connection in the /var/log/auth.log.

I had already tried using passwords instead of keys, looking at log files on both machines and getting nothing helpful. I could ssh from both sides to the other - without needing to give any kind of infomation.

However when I ran the rsync command, either within backupPC itself, or on my own root commandline I'd get an error telling me my shell was not clean. Lol. WHAT?

Normally this is due to the fact your shell is returning something other than a normal bash prompt. This can be caused by some funky scripting of your own in your bashrc or profile files. Mine were blank, I then commented out the "default" ones in /etc/profile and /etc/bash.bashrc "just in case".

All through this whole process I forgot one important point. Due to security concerns, backupPC no longer runs as root. It runs as its own user - backuppc.

After much moving of files "just in case backuppc can't read them" I realised I needed to try and connect AS backupPC to see what was happening.

su backuppc

/usr/bin/ssh user@host

OMG I doesn't return a bash prompt! Nope.... Instead its asking me if the key is ok. How could I forgotten to accept that?

Accepted and now backupPC works beautifully!

Tuesday, January 11

Moar Bash - Time to get some contact info...

Once again a task from work presented a strange challenge, reading the contact infomation for 400+ domains...

for x in $(cat ./list_of_domains); do whois -H $x | awk 'BEGIN{RS=""}/Registrant/,/Registration Service Provider:/ {print} END{print "----------------\n"}' && sleep 5000; done >> ./domain_infomation

Tada!

Wednesday, January 5

lil' bit o' Bash to kill a hard drive via shred

Just a lil' something I wrote to clear hdds as I was doing lots at work...

no error checking or anything sensible like that, use at your own risk ;)



tim.bowers@timDesktop ~ $cat ./bin/kill_drive 
#!/bin/bash
echo 'You wish to kill '$1'. Are you sure? (y/n)'
read consent
if [ $consent != "y" ]; then
echo 'Quitting'
exit
fi
sudo shred -v /dev/$1; xmessage -nearmouse Finished killing $1 &
exit

Search This Blog

Blog Archive