Tutorials

Tutorials for Linux Users

How to allow write permissions to mounted partitions...

Open up "/etc/fstab" in your favorite text editor, and add or edit the mounted partition line to be:

/dev/hda1 /mnt/dos1 vfat users,owner,rw,noauto 0 0

Meanings:
/dev/hda1 = hard drive partition
/mnt/dos1 = mount point where you want the disk mounted
vfat = filesystem type
users,owner,rw,noauto = options to mount

users => allow users to mount
owner => allow device owner to mount
rw => read and write permissions
noauto => do not mount at boot (otherwise will mount as root)
0 0 => backup option (to dump, don't dump) and fsck option (don't fsck)

Once you do this, any user can do:

$ mount /mnt/dos1

... and this will mount the filesystem.

Check the man on "fstab" and "mount" for more help.

If you want to get deeper into administration, you could set up an
automounter.

See:
Automount mini-Howto at TLDP.org

Set up a default editor...

The following example shows how to determine if an editor has been defined, and how to set up "vi" as the default.

$ echo $EDITOR
$ 
$ EDITOR=vi
$ export EDITOR

Get a Report of Missing Files from Apache Error Log

If you manage several sites on a server and want to track down the missing files, here is a hacked up script to do so. Put it into a weekly cron and chmod the file to be an executable.

#!/bin/sh
# /etc/cron.weekly/404.sh
# report of top 20 missing files in error_log
 
# array of error_log file paths of the different domains.
log_file=("/path/to/domain1/error_log" "/path/to/domain2/error_log" "/path/to/domain3/error_log")

(for ((i=0; i<${#log_file[@]}; i++))
do
  echo "Report of top 20 'missing' files in ${log_file[$i]}."
  for x in `grep "File does not exist:" ${log_file[$i]} | awk '{print $13}' | sort | uniq`
  do grep $x ${log_file[$i]} | wc -l | tr -d '\n'
    echo " : $x"
  # Change the head value to the number of missing files to report.
  done | sort -rn | head -20 
  echo
done) | mail -s "Missing File Report" username@yourdomain.com

Change the "username@yourdomain.com" to reflect the email address of the person that should get the reports.

NDISwrapper in Fedora using Dell TrueMobile 1300

This step-by-step walk through is for Fedora CORE 1.0 using a Dell Latitude CPi with the PCMCIA Dell TrueMobile 1300 (BroadCom BCM94306) 802.11b/g wireless network card.

Install the ndiswrapper by following the installation wiki documentation.

NOTE: I was getting errors with the current release and 0.9 version finally worked for me, so try installing previous releases and use the one which works for you.

Below are the steps that I took:
1. Install the ndiswrapper using the rpm.

#tar -zxvf ndiswrapper.tar.gz
#cd ndiswrapper
#make rpm
#rpm -Uvh /usr/src/redhat/RPMS/i386/ndiswrapper*.rpm

2. Install the windows driver as described in the infFile using ndiswrapper. You should have a ".inf" and a ".sys" file for this to work.

#mount /mnt/cdrom (place the Dell TrueMobile Driver disk in the cdrom first)
#ndiswrapper -i /mnt/cdrom/Setup/bcmwl5.inf

3. Load the ndiswrapper module

#modprobe ndiswrapper

The light on the card should turn on at this point.

Access Control to your web files via .htaccess

Setting up access control using HTACCESS

There is an advantage to controlling access to certain parts of your domain. If, for instance, you wanted to make general information public, but only wanted to make specific information available to your customers you could use a feature of NCSA-based httpd servers commonly reffered to as HTACCESS.

Using this access control method you can limit access to certain branches of the directory tree. If you want to really understand how this works, nothing is better than reading the manual.

Basic Access Control

You can control access to your webpage two different ways, by host filtering or user authentication. But keep in mind that neither method is fullproof. This should be considered as secure as a courtesy lock on a restroom door; nice, but ultimately ineffective.

The default name of the access control file is .htaccess but that is not written in stone. In the server configuration overview we looked at a file called httpd.conf. This file had the following entry:

Redirecting Dynamic URL using mod_rewrite

What do you do when you need to move servers or web-files to a different domain or directory, especially if you need to be moving dynamic content. How would you prevent down-time? This is not an end all solution, but Apaches' module mod_rewrite comes to the rescue of redirecting URLs.

Below are the steps that was taken to move web-files to a different servers.

1. Create a temporary unused sub-domain to point to the new servers IP address.

2. Allow for a day before you migrate your content to let the subdomain resolve.

3. Setup rewrite rule to redirect your current domain to the temporary domain after migrating content.

Binding Multiple IP Address on RedHat Linux...

Go to /etc/sysconfig/network-scripts where you will find a file "ifcfg-eth0" .

Copy this file to ifcfg-eth0:0, ifcfg-eth0:1, ifcfg-eth0:2, etc... one per IP you want to bind to the box.

Edit each file replacing the line eth0 with eth0:0, eth0:1, eth0:2, etc... as per the filename, and replace the IP address with your new ipaddress, so that you have one ifcfg-eth0:x file per ip address.

When you're done do: `ifup eth0:0, ifup eth0:1, etc...` or `service network restart`.

Security+ Library

a small but good collection of stuffz,

http://secinf.net/
http://iis1.cps.unizar.es/Oreilly/
http://hk8.org/old%5Fweb/
TEXTFILES.COM
http://www.redneckrepairs.org/soft/bookz/
http://www.comms.engg.susx.ac.uk/fft/
http://preterhuman.net/texts/
http://safariexamples.informit.com/
http://www.guxiang.com/epubcn/readings/diannaotushu/500/download/1107/ms_computer_dict_5th.zip
ftp://utopia.hacktic.nl/pub/security/ [ftp://utopia.hacktic.nl ]
http://filth.orcon.net.nz/Prentice.IP.In.Wireless.Networks.eBook-LiB/l-piiwn1.zip
http://filth.orcon.net.nz/Prentice.IP.In.Wireless.Networks.eBook-LiB/l-piiwn2.zip

Improving Hard Drive Performance - tuning with hdparm...

Note: You will need to be logged in as root to perform this tweak.

Default Settings:

#/sbin/hdparm -t /dev/hda

/dev/hda:
 Timing buffered disk reads:  64 MB in  3.57 seconds = 17.93 MB/sec

Identification info that was obtained from the drive at boot time:

#/sbin/hdparm -i /dev/hda
 
/dev/hda:
 
 Model=Maxtor 4D040H2, FwRev=DAH017K0, SerialNo=D21ZWSPE
 Config={ Fixed }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=57
 BuffType=DualPortCache, BuffSize=2048kB, MaxMultSect=16, MultSect=16
 CurCHS=4047/16/255, CurSects=-217054981, LBA=yes, LBAsects=80043264
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes: pio0 pio1 pio2 pio3 pio4
 DMA modes: mdma0 mdma1 mdma2 udma0 udma1 *udma2 udma3 udma4 udma5
 AdvancedPM=yes: disabled (255)
 Drive Supports : ATA/ATAPI-6 T13 1410D revision 0 : ATA-1 ATA-2 ATA-3 ATA-4 ATA-5 ATA-6

See the current settings:

#hdparm -v /dev/hda
 
/dev/hda:
 multcount    = 16 (on)
 I/O support  =  0 (16-bit)
 unmaskirq    =  0 (off)
 using_dma    =  1 (on)
 keepsettings =  0 (off)
 nowerr       =  0 (off)
 readonly     =  0 (off)
 readahead    =  8 (on)
 geometry     = 4982/255/63, sectors = 80043264, start = 0

Notice that I/O support is 16-bit, but doing research on the "Maxtor 4D040H2", I found that it support 32-bit. Also, unmaskirq is turned off and DMA mode is set to: udma2 (X66). The "MaxMultiSect" is the number to use for the multicount setting.

Download images from Sony Cyber-shot DSC-F88 to Fedora Linux

Here is a tip/hint that could hopefully help others having some difficulty with cameras that support "PTP".

PTP is the acronym for the "Picture Transfer Protocol". That protocol has a strong standards basis, in ISO and in terms of the USB Still Imaging class specification. Many upcoming digital cameras should support it.

The vision is that there will be enough new PTP-enabled cameras that it'll be much easier for you to just use them. You won't need to install new software and deal with its quirks each time you borrow or buy a new camera. Instead, you will be able to acquire images (and other media objects), reprocess them, (cropping, turning them right side up, signing them, applying steganograpy or other image transforms, etc.) and share them (printing, web publishing, etc) using whatever tools you prefer.

Enough with the PTP jabber... and here is how:

1. Install gPhoto, a free ready to use set of digital camera software applications.
2. Plug in your camera which supports PTP via USB.
3. Change to PTP mode instead of normal usb data transfer.
4. Run the command, `gphoto2 --get-all-files` to download your images.
5. It's as easy as that !!

Syndicate content
Comment