Archive for the ‘Documentation’ Category

How to find files modified in the last 24 hours using find.

I never seem to remember this. I always forget that it is the 0. I have used this on linux and unix.

find . -type f -mtime 0

How to find more than one name pattern:

find /tmp -name *.abc -o -name *.def -o -name *.ghi -o -name *.jkl -type f -print

Add new fonts to CentOS/RedHat/Fedora/Ubuntu

I used the following methodology to add some new TrueType fonts to my CentOS5 machine. The tmpfontdir is a temporary directory where I downloaded the fonts.

cd /usr/share/fonts/
mkdir -p truetype/myfonts
cp tmpfontdir/* /usr/share/fonts/truetype/myfonts
fc-cache -f -v ~/.font

How to block a particular port in MacOSX.

sudo ipfw add 1 deny tcp from any to any portnumber out
sudo ipfw add 2 deny udp from any to any portnumber out

Example:

sudo ipfw add 1 deny tcp from any to any 137 out
sudo ipfw add 2 deny udp from any to any 137 out

How I created a link to an smb share in MacOSX (Leopard)

vi /Users/username/Desktop/smbservername\:sharename.inetloc

smbservername:sharename.inetloc

This worked to map Windows shares on Macs with Netbios disabled.

How to disable Netbios on MacOSX (Leopard)

vi /etc/smb.conf

disable netbios = yes
smb ports = 445

Stop nmbd:

launchctl unload -w /System/Library/LaunchDaemons/nmbd.plist

Note: You may need to do the launchctl command a couple times. Not sure why but it did not always stop nmbd. Below is a portion of the nmbd.plist file. If set correctly to disable Netbios, you will see the KeepAlive instead of Enabled (the default).

nmbd.plist

How to re-create the Show Desktop icon in the Quick Tray in Windows XP.

Create a file called “Show Desktop.scf.”

[Shell]
Command=2
IconFile=explorer.exe,3
[Taskbar]
Command=ToggleDesktop

Right mouse click and drag the file to your Quick Launch bar and release. Select move.

Samba: joining a Windows Domain.

Source ONLamp.com:

Samba Joining a Domain

Resizing images via linux command line or script.

Make sure ImageMagick is installed. The convert command is part of the ImageMagick installation.

convert -geometry 240×160 filename newfilename

The following will resize several images in a script:

#!/bin/bash
for x in $(ls)
do
convert -geometry 240×160 $x new-$x
done

Blocking web access via squid

This is a configuration that I have used to restrict access to web sites via squid. It seems to work well for a small number of users.

From /etc/squid/squid.conf

acl Home proxy_auth REQUIRED
acl all src 0/0
acl block url_regex -i “/etc/squid/blockedsites.acl”
http_access deny block
acl allowsites url_regex -i “/etc/squid/allowedsites.acl”
http_access allow Home allowsites
http_access deny all

In /etc/squid/blockedsites.acl, I listed strings that when contained in a url will not be permitted. In /etc/squid/allowedsites.acl, I listed domain name strings that are allowed. For example, “.mozilla.org”. Then, if I want to allow to all sites except those listed in the blockedsites.acl, I just add “.”. to the allowedsites.acl.

Sample /etc/squid/blockedsites.acl:


myspace.com
youtube.com

Sample /etc/squid/allowedsites.acl:


.

This will allow users to go to all sites but myspace and youtube.

However, in this sample /etc/squid/allowedsites.acl:


.google.com

Users will only be allowed to go to google.com.

Pacbell mail settings – for old Pacific Bell Internet subscribers.

Authentication information: Use your full pacbell.net mail address. This is needed for both pop and smtp. And here is the gotcha, NO encryption of any kind! Good thing I don’t use mine for anything more than testing.

postoffice.pacbell.net port 110
smtpauth.sbcglobal.net port 25
No SSL boxes checked.

Return top

INFORMATION