Wednesday, July 7. 2010
Working on some servers recently has made me think about init.d and possibly creating a custom runlevel (e.g. 4), that shuts down everything, but SSH and networking (and its dependencies), and then disables login from anyone but a superuser or somone in a specified group - e.g. Staff,admin etc.
The default runlevel is 2/3 on most systems, with some systems using 5 for X11 and such, Level 1 is Single user, with Levels 0 and 6 being shutdown and reboot respectively.
The idea behind this would mean that maintanence could be conducted remotely on the server, without other daemons, or other users getting in the way - especially if you needed to conduct repairs to /home or /var say, which you can't do while it is in use.
Think of it as a remote users single user mode - but with minimal services like networking and ssh only, for use when you simply can't go to the datacenter and use init 1 (single user mode), and the task you need can be done remotely.
Not sure of the complete picture of how I would go about doing this yet, but it could prove useful for future use, possibly pushing this out via puppet to servers that are managed?
I'll probably look into this at some point, but for now it'll remain an idea.
Keith
Saturday, July 3. 2010
OK,
So i've been looking at the info for my Car, and the wiring for the stereo - after finally getting it out of its hole in the dash...
What i'm seeing is carnage, and i'm going to have to trace EVERY goddamn wire for the speakers, to find out what the fuck this guy has been doing!
The Car is a Ford Fiesta 98 S Reg, with a standard Ford 5000RDS Head unit, but the previous owner has added 2 rather large speakers into the rear parcel shelf.
This is the result, not only is one of the not even wired up, but the other was basically a short until i manually twisted the wires back together and secured it with electrical tape.
Whatever he has done, the Stereo no longer detects the rear speakers (allthough it does output to them), he's also left the original small speakers in the rear disconnected, theres no amplifier whatsoever, and to top that it looks as if he has attempted to attach wires to just about every wire on that connector. Its a good thing i'm good with wiring, thats all i can say!
  
See for yourself.
Keith
Sunday, June 20. 2010
Aparently this has been about for a while, but sudo has the ability to insult you if you type the wrong password.
Its quite nice - works on most systems - all you need to do is edit your sudoers file with visudo, and add the following to the end of the defaults line: insults
(Note the line is comma delimited).
Save the file, and then next time u get your password wrong, you'll get something like:
CODE: [sudo] password for archer:
Have you considered trying to match wits with a rutabaga?
[sudo] password for archer:
My mind is going. I can feel it.
[sudo] password for archer:
I feel much better now.
I found these by accident, whilst searching for the origins of a message sudo was giving, imagine my surprise when I found out it was a feature!
Enjoy!
Keith
Thursday, June 17. 2010
OK, a fix has been released for this problem on OSX (Thunderbird showing double the number of unread mails in the Dock Icon).
If you wish you can view the technical information for this bug at: https://bugzilla.mozilla.org/show_bug.cgi?id=557960.
This bug is fixed in 3.0.5, according to my systems anyways.
-Keith
OK, as everybody who has downloaded something on Snow Leopard knows, for most files you download when you try to open it after downloading, it will pop up a nice little dialog box saying that the file was recently downloaded from the internet and are u sure u want to open it.
Unfortunately this is not strictly neccessary - and is rather annoying for some file types (Especially NZB's).
The fix for this, is to create a plist file inside ~/Library/Preferences called com.apple.DownloadAssessment.plist with either TextWrangler, or the Property list editor.
If you are not comfortable creating plist files by yourself, my DownloadAssessment.plist file can be located here: com.apple.DownloadAssessment.plist, and you can just drop it into Library/Preferences under your Home Directory. (If you wish you can open this with something like TextWrangler, and verify that it looks exactly the same as below.).
The file should contain something similar to the following contents.
CODE: <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSRiskCategorySafe</key>
<dict>
<key>LSRiskCategoryContentTypes</key>
<array>
<string>public.xml</string>
</array>
<key>LSRiskCategoryExtensions</key>
<array>
<string>amz</string>
<string>nzb</string>
</array>
</dict>
</dict>
</plist>
NOTE: The amz extension shown above was allready marked as safe - at least on my system (you can remove this however), nzb is the one i have added.
All you need to do is add any file extensions that you don't want to be flagged as at risk, to the LSRiskCategoryExtensions section, and then add the UTI (Uniform Type Identifier) for that file extension to the ContentTypes section (FYI .nzb files are basically XML files hence the public.xml string). Note that if you are using a version of OSX < 10.5, then you can avoid listing every UTI, by simply using public.item as a string - unfortunately in 10.6 at least they changed the way UTI's are handled.
A list of UTI's can be found here: http://developer.apple.com/mac/library/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html
HTH,
Keith
Friday, May 28. 2010
Came across this today - its an interesting illusion, check it out, its actually one image repeated 3 times, but it looks as if its all one image.
http://cyriak.co.uk/blog/?p=102
Wednesday, May 26. 2010
OK,
For anyone who uses irssi and the lastfm.pl script, you may have noticed that the %player variable no longer works (its started returning an empty string) - at least in the current version - the maintainer of the script is aware, and should be pushing the change through as a new version shortly.
Until then you can follow the fix below.
The problem has arisen because last.fm has changed the layout of the page that the script uses to get the information. In order to fix this, edit lastfm.pl and navigate to line 283 it should look like this:
CODE: if ($content =~ m!<div class="scrobblesource">.*?Listening now using (.*?)</div>!) {
Change the line to the following:
CODE: if ($content =~ m!<span class="source">(.*?)</span>!) {
Save it, and then /script unload lastfm and /script load lastfm, and it should start working again.
Hope this helps.
Keith
Friday, February 26. 2010
OK, So i've been forced to have to set up an eggdrop -- what a ball ache!
Both ubuntu and Debian are now shipping a threaded version of TCL, unfortunately this mean eggdrop doesn't work, as for some reason it fails to detect properly if tcl is compiled as threaded.
It appears to start, but won't connect to a server properly, and won't allow you to telnet to it either.
Appears the easiest solution (from http://eggwiki.org/Threaded_Tcl) is after running ./configure. edit config.h and find #undef HAVE_TCL_THREADS, and change it to #define HAVE_TCL_THREADS 1
If you have allready compiled the eggdrop once, run make clean to clean out the compiled stuff, and then compile as normal (make && make install), and that should fix it, at least it has for me!
Not sure if/when the configure script is going to be fixed tho.
Keith
Thursday, February 25. 2010
If you've ever wanted to clear the contents of a file quickly, without breaking anything hooked into a file (useful for large files), look no further than the truncate command provided by the coreutils package.
CODE: truncate -s 0 fileame Instantly Shrinks the file to 0 bytes, and maintains anything associated with it.
Just be careful you don't accidently clear a file by accident, as theres no way to reverse, and it doesn't prompt you to confirm your selection
Keith
Wednesday, February 17. 2010
OK, so for anyone who uses OSX , and admins Linux machines, this can be a real headache.
For some reason the default settings for your Home and End keys that come with Terminal.App for OSX don't do what you expect - theyre Actually Swapped with Shift Home , and Shift End, but thats not all, as the escape sequence for Shift Home for example, is set to "\033[H". This seems to work fine on OSX, but unfortunately you try logging into a Linux Box with that, and on the command line it works, but try loading vi and using the Home key - and you get nothing. The same applies to the End key as well, OSX has it defined it as \033[F, however vim remotely does not like this either. (I Believe this applies to all termcap applications, allthough i can't be sure).
The Solution for both of these is to change the definitions of these keys, so theyre mapped as you expect, and get it to send the right escape sequence at the same time, I don't believe mapping OSX's [H and [F mappings in vim on the remote host, because well , when you admin 10 machines or more, it well doesn't make sense to put it mildly, so this is the only viable solution.
Before we can do this however we need to create a file, open up a Terminal window, and type the following: sudo nano /private/etc/inputrc, then enter your password (you need to be an admin user for this). Now paste in the following code: CODE: "\e[1~": beginning-of-line
"\e[4~": end-of-line followed by Pressing CTRL and X, then typing y, and hitting enter.
(Note: If you don't want to do this change system wide, change the command to nano ~/.inputrc, and add export INPUTRC="~/.inputrc" to your .profile)
Now we've done that we shall deal with Home/End, hit CMD I in terminal, and click Settings, followed by double clicking whichever entry is selected. In the window that appears click on the "Keyboard" tab, and find the entry for Home, click on it , and click edit. Change the action to "send string to shell:", now in the box below that, hit the following keys: " [1~" ( as in the escape key, and without the quotes) and click OK. Now do the same for End, except you type "[4~" (without the quotes).
Next find Shift Home, and edit that to change its action to: "scroll to start of buffer" then do the same for Shift End, editing that and changing its action to: "scroll to end of buffer".
Right, now Restart Terminal.
Try your home and end keys, they should work, both on command line and inside vim. Both locally and remotely. If they don't try hitting CTRL V .. it should reply with ^[[1~ .. and CTRL V should reply with ^[[4~. If it doesn't, you've gone wrong somewhere!.
Comments welcome.
Keith
Thursday, February 4. 2010
OK , it seems some times when installing packages, the installation scripts get a bit confused, and can't seem to handle initscript errors.
This results in said package being half installed, but marked as failed, On occasion running apt-get -f install or dpkg --configure -a, once you have solved the problem will get things into working order again.
These commands don't allways work however, and your left with a package stuck like this:
user@server:~$ sudo dpkg -l lighttpd
iF lighttpd 1.4.25-2 A fast webserver with minimal memory footpri
(iF meaning installation Failed)
In order to resolve this, if it still refuses to install properly (even after fixing the problem that caused the error in the first place), it is neccessary to force remove the package (unfortunately dpkg --purge or --remove on its own will not work).
Typing the following (replacing lighttpd with your package name), should get the system back into working order again.
CODE: sudo dpkg --force-remove-reinstreq --purge lighttpd
Then if you try running apt-get -f install, it should bring your system back into the correct state again.
There are other ways around this problem (I think manually installing the .dpkg archive via dpkg -i may work, but i havent tried it), but i think this is the easiest.
Anyways Tara for now!.
Keith
Saturday, December 26. 2009
OK, it appears as though somone in the debian community thought it was a good idea to make apt-get pull in Recomended packages, when it looks for dependencies, so therefore, when you try to install something like openssh-server for example, it grabs all the Recommends as well, which happens to include X11!.
Its easy to turn this off however by adding the following:
CODE: // Recommends are as of now still abused in many packages
APT::Install-Recommends "0";
APT::Install-Suggests "0";
to either /etc/apt/apt.conf or by creating a file inside /etc/apt/apt.conf.d/ like 00NoAptRecommends.
This at least for me, stops this most unwanted change... why they actually did this i shall never know.
[ Credits goto: blogs.KoolWal.net for finding out how to turn this off!]
Keith
Sunday, August 24. 2008
Right ,
I've recently had the pleasure of playing with mod_ruid again, and I've come across an issue with how it functions and mod_cgid,
Normally the cgid unix socket is owned by the userid of the parent process, but because ruid calls setuid it can no longer access the socket due to the permissions, meaning all calls to cgi scripts fail.
I've therefore had to switch out mod_cgid in favour of mod_cgi.
I'm unsure of any other way around this, as changing the permissions on the mod_cgid socket doesn't sound like an ideal solution,
Oh well, running mod_cgi seems to work sufficiently for my needs.
|