Thursday, August 25, 2005

Seeing all processes

'ps' is, as I'm sure you all know, a very useful command. 'ps' stands for 'process status' and it gives you information on running processes, and has almost as many options as ls. My standard ps bash alias is :




alias ps='ps -afuxww'


This shows all (-a) processes, swapped (-f, but only as root) processes, lots of information (-u), include "headless" apps, like daemons and the like (-x), and do it as wide as you can get (-w says 132 columns, -ww says use it as wide as you need).



Turns out, there are a couple of sysctl options that make ps more secure by not allowing "normal" users to show everything that is running. One of them is mentioned in the man page, security.bsd.see_other_uids (see the entry for the -a option). Kevin on the freebsd questions mailing list gives a cool little demo for setting and unsetting it from the commandline:


# sysctl -a | grep other_uid
security.bsd.see_other_uids: 1

# sudo sysctl security.bsd.see_other_uids=0
security.bsd.see_other_uids: 1 -> 0

# sysctl -a | grep other_uid
security.bsd.see_other_uids: 0

# sudo sysctl security.bsd.see_other_uids=1
security.bsd.see_other_uids: 0 -> 1

# sysctl -a | grep other_uid
security.bsd.see_other_uids: 1


But that's a 5.x option. The 4.x option is kern.ps_showallprocs - pretty straight forward name there. And to set this so that it gets correctly set every boot time, you put it in the /etc/sysctl.conf file:


kern.ps_showallprocs=1


ps (5.x)

ps (4.x)





Wednesday, August 24, 2005

Yet Another Boot Manager

There are a million boot managers out there. A boot manager, in case you didn't know, is something the OS geeks like myself use to select which OS to boot when the computer is restarted. It can be very useful for testing purposes. Say you want to see if your software works on Win98, or on some flavor of Linux. If you have the hard drive space, you create a new partition and install a completely standalong OS.

This is different than an emulator like Virtual PC or, even better, VMWare. Emulators run like just another program, and can bring the buffest hardware to its knees.

By using a boot manager, you can get a truly pristine setup. FreeBSD has its own boot manager - most non-Windows OSes will install their own, allowing you to choose between the dark side and the side of light and goodness. But the native ones are generally pretty basic, and don't give you things like partition managers, wizards, graphical interfaces, etc.

I've used a couple in my time. I used to be a huge fan of System Commander. I used it from version 1 up until last year, and was very happy with it. Easy to use, very smart, a great product.

But last year I started running into plenty of problems with it. The display would be garbled, and it just wouldn't work. I got less than satisfactory help from the VCom folks, so I started looking around.

Now I use BootIt NG from Terrabyte Unlimited. A shareware product that has worked very well for me. It's a little less easy to use, but has proven to be very powerful. While you're at the site, be sure to check out other, Windows, freeware utilities like BurnCDCC, which is a very easy to use ISO burner.

There are some freeware ones out there too. Grub is a standard one in the Linux world.

Here is GAG, a freeware one. I'll give it a shot on my test machine and see how it does:

The home page of GAG - main

Emacs delete key

Something that I never quite got working right was the key mapping on my FreeBSD box, at least when I was working locally and using Emacs. The normal key mapping has the Backspace key generating a Ctrl-h, which translate to a call for help in Emacs. But you really want it to behave by deleting the previous character, which is the default for the DEL key in Emacs. Why? Who knows.

It's not quite as important now for me, because I use a terminal program to connect to my remotely hosted box now, and it does the remapping for me.

Anyway, there's a function that plays some serious games with this and does it in a simpler way than mucking about with the translate table. Check out 'normal-erase-is-backspace-mode' - very interesting routine.

Man, Emacs has almost as many nooks and crannies as FreeBSD!