phpBook – guestbook admin url

Posted on in Categories Beyond nixCraft, Linux, News last updated December 29, 2004

This is one of the coolest guest book written in php/MySQL. You can download software from smartisoft website. Only problem is it does not show you admin url by default. Here is url that you need to use it!

yourdomain.com

YOURPASSWORD is stored in your config.php as variable $adminpass! Have a fun!!!

http://www.domain.com/guestbook/guestbook.php?action=admin&admin=YOURPASSWORD

Linux or UNIX Recover deleted files – undelete files

Posted on in Categories Backup, Data recovery, Linux, Sys admin, Tips, UNIX last updated December 18, 2004

If you rum rm command accidentally and deleted important a file, recovery becomes critical under Linux and/or UNIX oses.

Since Linux is multiuser and multitasking operating system other users/process can overwrite deleted file disk space. So you need to take down system to single user mode.

First use wall (only the super-user can write on the terminals of users) command write a message to all users, then use init (process control initialization) command to take system to single user mode.

Procedure

Following are generic steps to recover text files.

First use wall command to tell user that system is going down in a single user mode:
# wallOutput:

System is going down to .... please save your work.

Press CTRL+D to send message.

Next use init 1 command to take system to a single user mode:
# init 1

Using grep (traditional UNIX way) to recover files

Use following grep syntax:
grep -b ‘search-text’ /dev/partition > file.txt
OR
grep -a -B[size before] -A[size after] ‘text’ /dev/[your_partition] > file.txt
Where,

  • -i : Ignore case distinctions in both the PATTERN and the input files i.e. match both uppercase and lowercase character.
  • -a : Process a binary file as if it were text
  • -B Print number lines/size of leading context before matching lines.
  • -A: Print number lines/size of trailing context after matching lines.

To recover text file starting with “nixCraft” word on /dev/sda1 you can try following command:
# grep -i -a -B10 -A100 'nixCraft' /dev/sda1 > file.txt

Next use vi to see file.txt. This method is ONLY useful if deleted file is text file. If you are using ext2 file system, try out recover command. .

See also:

Virtuozzo VPS Linux MRTG configuration

Posted on in Categories News last updated December 16, 2004

This is bit tricky. But it is possible to configure MRTG for Virtuozzo VPS Linux. Please see MRTG configuration howto if you are new to MRTG. After running command:

# cfgmaker –global ‘WorkDir: /var/www/html/mymrtg’ –output /etc/mrtg/mymrtg1.cfg [email protected]

Above command will only look for 127.0.0.1 (both lo and venet0)as rest of real ips are alias to venet0 interface. You need to open mrtg file /etc/mrtg/mymrtg.cfg and edit it by hand:

1) Comment out lines (as follows)

2) Add IP addrss 127.0.0.1 and MaxBytes 1250000 as shown in bold letter as follows:


Target[rh3_2]: 2:[email protected]:
SetEnv[rh3_2]: MRTG_INT_IP="127.0.0.1" MRTG_INT_DESCR="venet0"
MaxBytes[rh3_2]: 1250000
Title[rh3_2]: Traffic Analysis for 2 -- rh3.cyberciti.org
PageTop[rh3_2]:

Traffic Analysis for 2 -- rh3.cyberciti.org

System:rh3.cyberciti.org in Linux (RH3_UP2), EV1 IDC2,TX.
Maintainer:Vivek G Gite <[email protected]>
Description:venet0
ifType:Other (1)
ifName:
Max Speed:1250.0 kBytes/s

Make sure you have properly configured snmp server. After that run mrtg as usual.

For more information see my Linux MRTG+SNMP step-by-step tutorial.

Virtuozzo iptables firewall

Posted on in Categories CentOS, Howto, Iptables, Linux, RedHat/Fedora Linux last updated December 5, 2004

Recently I got chance to play with Virtuozzo VPS. Good news is they are good to reduced cost and bad news (as of Dec-04, 2004) they do not support full iptables rule set like –state and –log etc. After spending more than 4+ hrs I was able to setup simple but effective firewall on Red hat enterprise linux Virtuozzo VPS. Here is script. Make sure you customize it for your environment.

FreeBSD: How to unload (remove) device driver (module) from kernel?

Posted on in Categories FreeBSD, Howto last updated December 1, 2004

FreeBSD comes with kldstat command. The kldstat utility or command displays the status of any files dynamically linked into the kernel. And the kldunload utility unloads a file which was previously loaded with lldload command. You can use kldunload command as follows.

Unload a file from the kernel

First login as a root user (use su – or sudo commnad):

Get list of loaded modules/drivers first use following command

# kldstat

To remove module use the following command

The kldstat utility displays the status of any files dynamically linked into the kernel.

kldunload -i ID

OR

kldunload module-name

Example to unload smbfs module

Type the following command as the root user:
# kldunload smbfs
OR
# kldunload -i 8

Please note that # 8 is module ID obtained using kldstat command.

Force the unload

You can pass -f option to kldunload to force the unload. This ignores error returns to MOD_QUIESCE from the module and implies that the module should be unloaded even if it is currently in use. The users are left to cope as best they can.
# kldunload -f smbfs

FreeBSD Load Device Driver / Kernel Module

Posted on in Categories FreeBSD, Howto last updated December 1, 2004

Under FreeBSD operating system you need to use the kldload utility to load file.ko into the kernel using the kernel linker. You can find all loadable kernel drivers in in /boot/kernel or /boot/modules/ directory. Some modules (pf, ipfw, ipf, etc.) may be automatically loaded at boot time when the corresponding /etc/rc.conf statement is used. Modules may also be auto-loaded through their addition to loader.conf.

You must login as root user to load or unload modules.

Task: How do I use kldload command to load module

To load smbfs module run command:
# kldload {module-name}
# kldload {driver-name}
# kldload smbfs

OR
# kldload -v smbfs
Sample output:

Loaded smbfs, id=8

FreeBSD > How to setup FreeBSD as DNS client?

Posted on in Categories News last updated December 1, 2004

Local name resolution is done via /etc/hosts file. If you have small network then use /etc/hosts file. DNS (domain name service is accountable for associating domain names with ip address, for example domain yahoo.com is easy to remember than IP address 202.66.66.12) provides better name resolution. To configure FreeBSD as DNS client you need to edit or modify /etc/resolv.conf file. This file defines which name servers to use.

Steps to configure FreeBSD as DNS client
1) Login as a root user

$ su -

2) Open /etc/resolv.conf file using text editor

# vi /etc/resolv.conf

3) Add ISP nameserver as follows:

search isp.com
nameserver 202.54.1.110
nameserver 202.54.1.112
nameserver 202.54.1.115

Note Max. three nameserver can be used/defined at a time.

4) Save file

5) Test dns using ping, dig or nslookup commands:

$ dig www.cyberciti.biz
$ dig mx google.com
$ dig a yahoo.com
$ nslookup nixcraft.com
$ ping www.cyberciti.biz

OR
Use browser to browse Internet.

See also: