The Crane Has Landed


Fun with Cisco
October 16, 2011, 2:33 pm
Filed under: Asterisk, VOIP

This is a bit obscure, but I have managed to set up an Asterisk PBX server with some old Cisco 7910 phones. They have their idiosyncrasies though, so here are a couple of tips I’ve picked up along the way:

  1. To edit the settings on the phone (e.g. change the TFTP server), you need to unlock the settings by pressing “**#” and then the Settings key. Doing so should make the padlock icon turn to unlocked.
  2. You can then edit the editable settings by pressing the “*” key, with the “#” key saving your changes.


LDAP issue with sendmail
August 20, 2011, 1:06 pm
Filed under: Linux

For some reason, I suddenly stopped receiving email notifications of my voicemail from my trixbox server. A bit of hunting around, I discovered the following error in the logs, or when I tried to manually send mail using sendmail:

451 4.3.5 Error getting LDAP results in map ldapsx: Unknown error 325
sxadmin-scalix@scalix... Deferred: 451 4.3.5 Error getting LDAP results in map ldapsx: Unknown error 325

All of this occurred after I changed my DNS suffix on my new router. To fix the problem, I updated the OMHOSTNAME setting in /etc/opt/scalix/instance.cfg to what the fully-qualified name was et voila! All working when I use the following test code:

echo "Subject: test" | /usr/lib/sendmail -v my@email.com



Bulk create symbolic links to directories
April 8, 2011, 6:45 pm
Filed under: Linux | Tags: ,

Since you can’t use the cp command to create links to directories, I found another site with a great use of the find command:

find path_to_the_directories_you_want_to_link_to -type f -exec ln -s \{\} . \;

This should create a symbolic link for each of the directories it finds in the path provided. Brilliant!



Remote notification
January 12, 2011, 11:04 am
Filed under: MythTV, networking, Ubuntu, xbmc

I have been playing around with a way to get my Ubuntu box (that is running VLC on startup to stream our satellite TV across the network) to notify other boxes that it is awake and broadcasting. This is so that my wife can start the box up from a WOL script on the kitchen PC and then, once it is booted up, turn on the modded Xbox and run XBMC to connect to the stream and pick up TV downstairs.

Nice enough. :)

I managed to get it working using the following steps.

  1. On the PC that broadcasts TV, I added passwordless SSH (via this link) for the user that the kitchen PC runs under.
  2. On the kitchen PC, I created a script in the /usr/bin called notifier that has the following in it:
    export DISPLAY=:0 && export XAUTHORITY=/home/[KITCHEN COMPUTER USERNAME]/.Xauthority && sudo -u [KITCHEN COMPUTER USERNAME] /usr/bin/notify-send "TV is now broadcasting" 2>&1.

    Most of this is via this page.

  3. After adding the same user to the TV PC, I have a line in the TV PC /etc/rc.local that says
    su [KITCHEN COMPUTER USERNAME] -c notifyKitchen
    The notifyKitchen is a /usr/bin script that simply says
    ssh [KITCHEN COMPUTER USERNAME]@[KITCHEN COMPUTER] 'notifier'.

Done and done. When the TV PC boots, it calls this command and the Kitchen PC gets a pop-up notification that TV is running.



Building a VPN
January 4, 2011, 9:20 am
Filed under: Linux | Tags:

So, being the holidays and everything, I thought it would be useful to be able to dial-in to my home network and get access to all my local network resources. I first tried to do this when I was in San Francisco over Putty SSH. Can I just note for everyone reading this that this is not a good idea because if anything goes wrong (like when trying to create a new bridged interface), your network connection goes down…and so does your SSH connection!

But I’ve had a bit of better luck following the howto on OpenVPN.net and have got it so that I currently have a routing connection (not bridged) up and running. So an internal IP address now accesses my server, and I’m able to access the Samba shares, and the VOIP network as well! :)

Now, I’m just going to work on bridging the network…when I get home! ;)



Tip: how to get the size of a folder in Linux CLI
October 24, 2010, 7:15 pm
Filed under: Linux, Tips, Ubuntu | Tags: , , , ,

It seems like a simple request…and it mostly is. But if you want to get the size of a folder – including sub-folders – in Linux from the command line, you need to use the du command. The simplest trick (thanks linuxforums.org) to get the total size without listing all the sub-folders is to use the following:

du -h | grep -v '/' | awk '{print $1}'


Windows 7 Home Premium remote desktop
July 15, 2010, 4:06 pm
Filed under: Windows

Found a great link to a patch that enables remote desktop hosting in Windows 7 Home Premium: http://thegreenbutton.com/forums/p/79427/393664.aspx#393664.

Very nice. :)

UPDATE: once running Service Pack 1, you need to update the patch.



Shutting down via the web
July 5, 2010, 10:15 pm
Filed under: Tips, Ubuntu | Tags: , ,

One of the annoying things about Ubuntu is the fact that you need to be an admin user to shutdown the PC. This makes sense if you are running a server, but not when you have a few PCs scattered throughout the house that you’d just like to shutdown quickly.

So, I found a way to enable this through Apache. Warning: this will allow anyone who browses to your PC to shut it down without prompting. So use carefully.

Basically, what you need to do is remove the need for admin/sudo access when shutting down as the www-data (Apache) user. To do this, you use a specific command called visudo which specially edits a file containing what commands require admin access.

In short, make sure that the last line in that file is the following:

www-data ALL= NOPASSWD: SHUTDOWN_CMDS

and that there is a line further up that says Cmnd_Alias SHUTDOWN_CMDS = /sbin/shutdown, /sbin/reboot, /sbin/halt.

Then, once this is done, you can have a shutdown.php that has the following code:

<?php
echo exec('sudo shutdown -h now');
?>

Q.E.D.



Symbolic linking in Windows to clear up space
June 7, 2010, 4:25 pm
Filed under: Windows | Tags: ,

My laptop is running Vista 32-bit at the moment, and the C:\Windows\Installer directory is over 5GB big! Not too pleased about that, I set about trying to find a way to either delete it or move it to my bigger D:\ partition.

I found a great link on cloud.net that mentioned Junction – a free app that allows the new(ish) symbolic link functionality to work in Windows.

Using it, I was able to move the whole folder to the D:\, and then use the command

junction C:\Windows\Installer D:\Windows\Installer

to trick Windows into thinking that the folder is still there.

Something I’m used to doing on Linux, but not Windows.



Tricksy trixbox
April 5, 2010, 11:15 pm
Filed under: Asterisk, CentOS, VOIP | Tags: , , , ,

I have learned a lot about running Asterisk PBX at home…and still have much to learn. However, notes for my own records follow:

  • When installing trixbox (a FreePBX + Asterisk distro based on CentOS), note that the default install option will format all hard drives attached to the system!!!!  It does mention that the drive will be formatted, but doesn’t underscore that everything attached to the system – including USB hard drives – will be lost.  That’s a whole weekend of having to recover from an aborted partial total format of my server!  Use the advanced option from the boot: screen when installing
  • The default password for the FreePBX web client admin user (which you should change) is “password” for a username of “maint”. You can change this through the /etc/trixbox/httpdconf/trixbox.conf file.

Some more CentOS tips:

  • CentOS is different from Ubuntu/Debian-based systems in many ways. I’m still learning all of them (like yum -y install instead of apt-get install) but some gotchas – like the fact that package names are different (c.f. samba-client
  • vs. smbclient) – are more important than others.

  • To get the prompt in the bash terminal to be more like Ubuntu, either copy the ~/.bashrc from an Ubuntu machine (if you have one) or try this tip:
    echo 'PS1="[\u@\h \W]\\$ "' > /root/.bashrc
  • To install Webmin, follow these great instructions:
    wget http://internap.dl.sourceforge.net/sourceforge/webadmin/webmin-1.500-1.noarch.rpm
    rpm -ivh webmin-1.500-1.noarch.rpm
  • To play with networking settings (e.g. setting up a static IP rather than DHCP), use system-config-network
  • If you install Samba server and want to restart it, it’s under /etc/init.d/smb (not samba).
  • If you get an error re: some packages not working (like dahdi), then use yum update to update the lot. Probably a good idea to run that anyway.
  • The default MySQL root password is "passw0rd".

More tips to come later.




Follow

Get every new post delivered to your Inbox.