I recently found an article on GIZMODO about LEGOs. Looking back on all the Lego experiments I had as a kid, it’s very interesting to see some facts about Lego’s revealed.
Here’s some facts from the article:
Their Mindstorm NXT includes Bluetooth capability for communicating.
In their entire history, there has not been a single report of a Lego decomposing or releasing toxic byproducts.
There are very few bad bricks produced at the plant - mostly due to their very precise brick-making process.
[via GIZMODO]
Sometimes, for auditing purposes, it can be useful to look for users and groups which are “orphaned” or have no users/groups associated with them.
Finding Orphaned Users
Use this script to find orphaned users:
1: USEREXCLUSIONS=( sync shutdown halt operator )
2: USEREXCLUSIONSNUM=${#USEREXCLUSIONS[@]}
3:
4: for i in `cat /etc/passwd | awk -F : {'print $1'}`; do
5:
6: command=`grep $i":x" /etc/group | wc -l`
7: if [ $command -lt 1 ]; then
8:
9: for ((t=0;t<$USEREXCLUSIONSNUM;t++)); do
10: look=${USEREXCLUSIONS[${t}]}
11: if [ $i = $look ]; then
12: orphaned=0;
13: break;
14: else
15: orphaned=1;
16: fi
17: done
18:
19: if [ $orphaned -eq 1 ]; then
20: echo $i" is orphaned!"
21: fi
22:
23: fi
24:
25: done
Finding Orphaned Groups
Use this script to find orphaned groups:
1: GROUPEXCLUSIONS=( sys tty disk mem kmem wheel dip lock users floppy utmp slocate )
2: GROUPEXCLUSIONSNUM=${#GROUPEXCLUSIONS[@]}
3:
4: for i in `cat /etc/group | awk -F : {'print $1'}`; do
5:
6: command=`grep $i":x" /etc/passwd | wc -l`
7: if [ $command -lt 1 ]; then
8:
9: for ((t=0;t<$GROUPEXCLUSIONSNUM;t++)); do
10: look=${GROUPEXCLUSIONS[${t}]}
11: if [ $i = $look ]; then
12: orphaned=0;
13: break;
14: else
15: orphaned=1;
16: fi
17: done
18:
19: if [ $orphaned -eq 1 ]; then
20: echo $i" is orphaned!"
21: fi
22:
23: fi
24: done
Recently I was reading an article here which shows how an application called “Search Tracker” guided searchers to an autistic man named "Keith kennedy late Sunday in a wooded area.
The software calculates the possibility that someone would be lost in certain areas based on density of plant life and wooded areas.
More on this story at LinuxInsider.
Have you ever had a hard time with spammers or recently logged in to one of your Linux servers only to find 10-20+ exim processes hogging all of your resources? Check out the commands below to help you manage your queue.
Count The Messages
Count the number of messages in your queue. If this number is abnormally large; it’s usually a good indication of some malicious activity on your server.
# exim -bpc
View The Messages
After finding out you have 1000’s of messages in your exim queue it might be a good idea to stop the exim service.
# service exim stop
After stopping the service run this command to see what’s in the queue:
# exim -bp | less
This will pipe the results to the less command to enable you to page through and search the results. Find one of the message ID’s that seem to be duplicates (spam) and copy it to your clipboard.
A message ID looks like this: 1KBB28-0006UC-Fl
Run this command to view the header of the suspect message:
# find /var/spool/exim/input -name "1KBB28-0006UC-Fl-H" -exec cat {} \;
or this method with exim
# exim -Mvh 1KBB28-0006UC-Fl
The header can show you exactly where the message is originating as well as the recipient. If the spammer is connecting directly to your SMTP server you can also gather the IP address here.
Removing The Messages
Let’s get the messages out of the queue. For our example, we’ll use the address foo@bar.com as the sending address. To remove all emails in the queue for foo@bar.com run this command:
# exim -bp | awk ‘$4foo@bar.com { print $3 }’ | xargs exim -Mrm
With cheaper storage you might find yourself literally submersed in storage devices. It is possible to have your block devices change (from sdc to sde) when using multiple controllers of the same model (I’ve experienced this with 3Ware controllers). So how do you know where to mount your devices after a reboot? Use e2label to label your disks (much like NTFS labels in Windows).
Labeling Your Device
To label your device follow these steps:
# e2label /dev/sdb1 awesomedisk
Modifying Your fstab
Now you can modify your fstab to reflect your label changes. Instead of using the path to the block device (/dev/sdb1) you can use this syntax: (LABEL=awesomedisk)
Example:
LABEL=awesomedisk /mnt/awesomedisk ext3 defaults 1 1
Check Current Label
To check the label currently set for a block device use this command:
# tune2fs -l /dev/sdb1 | grep "Filesystem volume name:"