Linux

Technical Notes

These notes are my personal online notebook of useful commands and "how-to's". You are welcome to make use of them if you find them helpful. They obviously don't come with any warranty! Click on one of the category tags above for the notes in any category.

Strategy for MX backup for email reliability

How to chroot

Here is a good link on how to Recover a Non-booting Linux System
http://roderick-greening.blogspot.com/2009/09/recover-non-booting-linux-...

and the core:

ubuntu@ubuntu:~$ sudo mount /dev/sda6 /mnt
ubuntu@ubuntu:~$ sudo mount /dev/sda1 /mnt/boot
ubuntu@ubuntu:~$ sudo mount /dev/sda7 /mnt/home

Verify everything looks correct before proceeding (i.e. you got the partitions correct and mounted in the correct places).

Next, you need to take care of /proc and /dev as follows:

ubuntu@ubuntu:~$ sudo mount -t proc none /mnt/proc

dynamic DNS

To use a dynamic DNS system, register an account with http://www.zoneedit.com
Documentation on: http://www.zoneedit.com/doc/dynamic.html
download http://ddclient.sourceforge.net/
You will need to change the section for zoneedit near the bottom, plus at the top set the interval to what you want (from 300) and uncomment:
use=web
There may be a problem if the password contains punctuation characters

Samba Server Setup

This is very "quick and dirty" using the CentOS gui tools as much as possible

-install server & open firewall to samba
-create office and supervisor groups and a /home/common folder
-create all users on server and make them part of office, (+supervisor)
-add all users to Samba with Windows names and passwords
-share all home drives and set user access on shares as appropriate
-set permissions in the directory at the root of each share, appropriate to users
-chmod g+w -R * #at the top level of each shared directory so groups can read and write

Useful Linux Programs and Utilities

mdb Viewer (views access files, 97 and newer)
fontmatrix (organize your fonts)
meld (view differences between files)
spe (Stani's Python Editor) - http://pythonide.blogspot.com/
gadmin-samba (visual samba administration)
webHTTrack (download whole websites)
kiki (regular expression tester)
mysql-gui-tools.i386 (administrator & query browser)
Dag Wieer's advice on setting up putty: http://dag.wieers.com/blog/improving-putty-settings-on-windows
Very good list of monitoring tools: http://www.cyberciti.biz/tips/top-linux-monitoring-tools.html

Curl example


# login
curl http://localhost/drupal/?q=user \
-s \
-c cookie.txt \
-b cookie.txt \
-F 'name=user' \
-F 'pass=pass' \
-F 'form_id=user_login' \
-F 'op=Log in' \
--output response0.html
#
# get form
curl http://localhost/drupal/?q=node/add/page \
-s \
-c cookie.txt \
-b cookie.txt \
--output response1.html
# -> extract token from response1.html (/edit-page-node-form-form-token" *value="([^"]*)"/)
#
# add page
# -> use extracted token
curl http://localhost/drupal/?q=node/add/page \

Xorg problems and resolution

The best resources I found were:
How to create a modeline: http://xtiming.sourceforge.net/cgi-bin/xtiming.pl
Some general tips: http://www.x.org/wiki/FAQVideoModes
A complex example: http://www.mail-archive.com/fedora-list@redhat.com/msg12682.html
Some detailed debugging tips: http://redhatcat.blogspot.com/2007/09/xorg-for-sharp-aquos-and-nvidia-88...

Using the last link, I found that there were three video ports on the card (DVI0, VGA0 and VGA1) and all my settings were being applied to the wrong one.

Here is the first part of redhatcat, on how to do debugging:

Linux notes

KDE & Gnome hotkeys: http://www.clug.ca/node/225
Cool bash history tips: http://meandubuntu.wordpress.com/2009/01/05/cool-bash-tips/
Haven't tried this, but looks very useful: How to Recover from a Linux Hang (raising elephants)
Find version: rpm -q centos-release
Network down/up/new ip: ifdown eth0 , ifup eth0 , dhclient eth0
ifconfig eth1 down or up

To keep ssh open, edit /etc/ssh/ssh_config and add: ServerAliveInterval 180
truncate a log file: cat /dev/null > some_log_file.log

Syndicate content