20070710

# Changing linux hostname

check with uname -n, hostname -[ asdf]
modify /etc/hosts
hostname .
modify /etc/sysconfig/network
check with cat /proc/sys/kernel/hostname

key : how to change a hostname linux

20070413

guest2admin

echo off
title Please wait...
cls

net user add Username Password /add
net user localgroup Administrators Username /add
net user Guest 420 /active:yes
net localgroup Guests Guest /DELETE
net localgroup Administrators Guest /add

del %0

save in notepad as "guest2admin.bat"
then u can double click the file to execute or run in the cmd.
it works...


~ Cheers ~

from rahulhackingarticles

20070406

Save putty default settings

I hope there is an easier way to save the default settings for Putty. Rather than have to write 'Default Settings' in the Saved Sessions textfield, and click Save. By the way, I use PortaPutty. Because it stores saved sessions in a folder, not in the Windows Registry like what original Putty does. So you can store Putty on your thumbdrive.

20070328

unix sex philosophy

unzip; strip; touch; finger; mount; fsck; more; yes; umount; sleep

20070325

edquota problem | open is a directory

You should touch a filename quota, not to create a folder quota. Rename it or remove the folder.

from docs.sun.

crontab edit problem

if crontab -e gives some random number, and you didn't see any existing cron, might be you didn't set your EDITOR variable:

$ EDITOR=/usr/bin/vi
$ export EDITOR
$ crontab -e

20070324

understanding between blocks and kilo bytes

I admit I'm a bit slow for this kind of basic convertion. During my young age, I always wonder about blocks and bytes and how to convert between them and recently it became clear after some try and error calculation on df output. This is important because some program require user to input size in blocks such as ulimit.

In ulimit manpage, I read an option which is
-c The number of 512-byte blocks on the size of core dumps.

So I can assume that 1 block equals to 512 bytes (to reader, please assist, thanks). If I look at one line of my df output:

/export/home (/dev/dsk/c0t0d0s7 ):53645828 blocks 3232280 files

Then I know that my home directory took 53645828 * 512 / 1024 of Kilobytes. To be sure it is correct, use df -b:

/dev/dsk/c0t0d0s7 26822914

That means 53645828 blocks equals to 26822914 bytes.

one of the reasons apt-get fails

My apt-get failed lastnight, and I realized it was because of my /etc/services:

finger 79/tcp
ssh 80/tcp # customized port
ssh 80/udp # customized port
#www 80/tcp http # WorldWideWeb HTTP
#www 80/udp # HyperText Transfer Protocol
link 87/tcp ttylink


After I commented the ssh lines and uncommented the www lines, apt-get runs fine.

20070308

forgot, forgot, forgot...

insmod Insert an LKM into the kernel.
rmmod Remove an LKM from the kernel.
depmod Determine interdependencies between LKMs.
kerneld Kerneld daemon program
ksyms Display symbols that are exported by the kernel for use by new LKMs.
lsmod List currently loaded LKMs.
modinfo Display contents of .modinfo section in an LKM object file.
modprobe Insert or remove an LKM or set of LKMs intelligently. For example, if you must load A before loading B, Modprobe will automatically load A when you tell it to load B.

from tldp.

20070120

notes: solaris' hostname, ip

Files to edit/change hostname manually
--------------------------------------
/etc/hosts
/etc/nodename
/etc/hostname.xxn (xxn = network interface, such as hme0)
/etc/net/ticlts/hosts
/etc/net/ticots/hosts
/etc/net/ticotsord/hosts
/etc/inet/ipnodes (if file exists and if hostname entry exists)

Files to edit/change the IP manually
------------------------------------
/etc/hosts
/etc/defaultrouter
/etc/netmasks


..and a script thanks to Sandra Henry-Stocker & David Cashion

20070118

cron, at by example b4 rtfm

want to use cron? first create a script

#!/bin/sh
apt-get update


and create mycron.txt(or w'ever name u want), add:

30 23 * * * /home/bambino/script

will run script on 11.30pm everyday. finally, `crontab mycron.txt` as root

want to use at? just `at 11pm 2days`, then enter your commands.

bambino:/home/bambino# at 11pm + 2days
warning: commands will be executed using /bin/sh
at> apt-get update
at> [^D]
job 4 at 2007-01-22 16:00
bambino:/home/bambino#


will run update apt 2days later at 11pm.
to list jobs, `atq`
to show spec. job, `at -c [jobnumber]`

apache, authentication, htaccess, htpasswd

Create a file .htaccess in the web directory

#.htaccess
AuthUserFile /home/bambino/public_html/.htpasswd
AuthGroupFile /dev/null
AuthName EnterPassword
AuthType Basic
require user bambino


To create a user, `htpasswd -c .htpasswd bambino`

20070115

navigating Solaris default man pages sucks

Solaris man pages are using more.

So to change to less, set PAGER environment variable to less:

$ export PAGER="less"

############################################

Update August 18th '07

# export PAGER="less"
PAGER=less: is not an identifier


so i use,
`PAGER="less"; export PAGER`

20070112

enable rstatd on Solaris 10

rstatd is important for stdperfmeter to work. But 5.10 disables it by default.

# svcadm enable rstat

to check, use rpcinfo -p

20070111

secure solaris, auto-boot and eeprom

Auto-boot parameter in eeprom can disable Sun's machine from entering PROM.

# eeprom "auto-boot?"=false

And there are more parameters for consideration credit to Jeff Hunter

20070108

today's note: solaris

kayword: solaris unable to boot CD DVD PROM man -k windex

Get into PROM during boot: command + A

if `man -k` returns /usr/share/man/windex: no such file or directory we have to create the windex database which is also used by whatis and apropos by `catman -w`. While in Linux, `catman` is enough.

20061229

classful addressing

00000000 - 01111111 = class A = 1.xxx.xxx.xxx - 126.xxx.xxx.xxx
10000000 - 10111111 = class B = 128.xxx.xxx.xxx - 191.255.xxx.xxx
11000000 - 11011111 = class C = 192.xxx.xxx.xxx - 223.255.255.xxx
11100000 - 11101111 = class D = 224.xxx.xxx.xxx - 239.x.x.x
11110000 = 11110111 = class E = 240.xxx.xxx.xxx - 247.x.x.x

20061218

Safe kill procedure

kill pid (sends a TERM, wait 5 seconds)
kill pid (yes, try again, wait 5 seconds)
kill -INT pid (wait for it)
kill -INT pid (damn, still not dead?)
kill -KILL pid (same thing as -9)
kill -KILL pid (something is wrong)


If the process is still running, then stop sending it signals. It's either stuck in I/O wait or it's Defunct. 'ps auxw | grep processname', if you see it's in state D, then kill its parent process (the 3rd column of 'ps -ef' is the parent pid). If it's in I/O wait, then you have a deeper system problem. Most home users will never have this problem.

Credit to Hawkwind

20061217

tar and gz/bz2 in a line

tar -cf - file_to_pack1 file_to_pack2 ... | gzip -c > packed_files.tar.gz

tar -czf packed_files.tgz file_to_pack1 file_to_pack2 ...

20061122

Permission denied (publickey).

00:53:52 ssh myuser@my.domain.net
Permission denied (publickey).


If this happen, set value for ChallengeResponseAuthentication to yes.

ChallengeResponseAuthentication yes