11/17/2008

Reset mac's password with single user mode

I just received a Mac mini from colleague last night. However, it's passworded. When I wanna retrieve password, my have no idea to keep in touch with him. (Damn). I searched for reseting mac's password, all tells me is put in the install CD and reset the password. Unfortunately, my mac mini eject install DVD every time when i start the mac, and this means i can't change password with this way. This morning, i just searched reset mac's password with single user mode.

Command + S when booting your mac.
$ mount -uw /
$ launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist
$ dscl
$ cd /Users
$ passwd root

Now you have your root with new password.

10/27/2008

Xorg runs wildly

My Server (Ubuntu 7.10 with 2.6.22-15 kernel) run Xorg wild these days before. It eated almost 100% cpu usage. Here is the solution if you meet the same problem with me.

$ sudo vim /etc/X11/xorg.conf

+ Section "ServerFlags"
+ Option "NoTrapSignals" "true"
+ EndSection

after rebooting, my system comes back well again~ ^^

another suggestion is that we add the following into xorg.conf

+ Option “UseEvents” “on”

i never tried this method, if this way doesn't work, please tell me.

4/23/2008

upgrading ubuntu release

$ sudo apt-get install update-manager-core
$ sudo do-release-update

4/22/2008

make-ssl-cert

certification used by apache2 can be generated by "make-ssl-cert". however, the period is only for 1 month. it's too short for most administrators. therefore, we can modify make-ssl-cert to expend the validation period.

$ sudo vim /usr/sbin/make-ssl-cert

find "-keyout $output", append "-days 365" in the tail. than execute make-ssl-cert, the period will by one year.

2/02/2008

Linux OpenVPN server and Windows client simple Howto

# apt-get install openvpn
# cd /usr/share/doc/openvpn/examples/easy-rsa
# . ./vars
# ./clean-all
# ./build-ca // generates ca.crt, ca.key
# ./build-key-server diana // generates 01.pem, diana.crt, diana.csr, diana.key
# ./build-key vesta // generates vesta.crt, vesta.csr, vesta.key
# ./build-dh
# openvpn --genkey --secret ta.key

SERVER
copy files just generated to /etc/openvpn

# vim /etc/openvpn/server.conf
local 192.168.1.100
port 1194
proto tcp // i can't run under UDP
dev tun
tls-server
ca ca.crt
cert diana.crt
key diana.key
tls-auth ta.key 0
dh dh1024.pem
server 10.12.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway"
push "dhcp-option DNS 10.12.0.1"
push "dhcp-option DNS 140.117.205.1"
push "dhcp-option DNS 140.117.11.1"
keepalive 10 120
comp-lzo
max-clients 3
persist-key
persist-tun
status /var/log/openvpn-status.log
verb 3
daemon
# /etc/init.d/openvpn start
# sysctl -w net.ipv4.ip_forward=1
# iptables -t nat -A POSTROUTING -s 10.12.0.0/24 -o eth0 -j MASQUERADE

CLIENT
to http://openvpn.se/ to get OpenVPN Windows GUI, and install it.
copy client.ovpn from Program $OVPNInstDir/sample-config to $OVPNInstDir/config.
copy ca.crt, ca.key, vesta.crt, vesta.csr, vesta.key to client_server to $OVPNInstDir/config.
modify client.ovpn
client
dev tun
proto tcp
remote 192.168.1.100 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ns-cert-type server
tls-client
ca ca.crt
cert vesta.crt
key vesta.key
tls-auth ta.key 1
comp-lzo
verb 3
done

1/31/2008

Trojan-PSW:W32/OnlineGames

to clean this virus, first of all, clean the register kill, use regedit.exe and find

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run

clean the kavo.exe or taso.exe, and reset the windows hidden file value to 1

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ Explorer\Advanced\Folder\Hidden\SHOWALLCheckedValue

change the value from 0 to 1, start task manager, kill explorer.exe and run explorer.exe again. ( for showing hidden files.)

to root directory of all your disks, delete autorun.inf and ntdelect.com.
to system_device:/windows/system32/, delete kavo*.* and taso*.*.

then restart windows.

1/19/2008

shut down ipv6 protocol on ubuntu

$vim /etc/modprobe.d/aliases
# alias net-pf-10 ipv6
$vim /etc/modprobe.d/blacklist
+ blacklist ipv6
done

1/14/2008

RubyonRails installation

it's quite simple to install RoR on ubuntu.

$ apt-get install ruby1.8

go to here to get the newest gem.

$ tar zxf rubygems-1.0.1.tgz
$ cd rubygems-1.0.1/
$ sudo ruby setup.rb

install rails

$ sudo gem install rails --include-dependencies

Rails rely on lots of gems, we need install some first

$ sudo gem install actionmailer
$ sudo gem install actionpack
$ sudo gem install activerecord
$ sudo gem install activesupport
$ sudo gem install actionwebservice
$ sudo gem install rake

done

1/11/2008

change mysql default charset to UTF-8

$ sudo vim /etc/mysql/my.cnf
[client]
+ default-character-set = utf8

[mysqld]
+ default-character-set = utf8

$ sudo /etc/init.d/mysql restart

adding ssl to apache2 on ubuntu

it's also simple, and we can also google this easily. here is just a note.

$ sudo mkdir /etc/apache2/ssl
$ sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache2.pem
$ sudo a2enmod ssl
$ sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl
$ vim /etc/apache2/sites-available/ssl
NameVirtualHost *:443
<virtualhost *:443>
ServerAdmin webmaster@localhost

SSLEngine On
SSLCertificateFile /etc/apache2/ssl/apache2.pem</virtualhost>
$ vim /etc/apache2/sites-available/default
NameVirtualHost *:80
<virtualhost *:80></virtualhost>
$ sudo a2ensite ssl
$ sudo /etc/init.d/apache2 restart

timezone issue on ubuntu

ubuntu system will set bios time as default UTC time. therefore, the system time will be set to +8 in taiwan. which means BIOS maintains the correct localtime but it goes faster 8 hours in ubuntu system.

modify /etc/defaults/rcS
- UTC = yes
+ UTC = no
and link localtime to correct position
$ sudo ln -sf /usr/share/zoneinfo/Asia/Taipei /etc/localtime
done

Install mySQL on Ubuntu Linux

Installing mySQL on Ubuntu is quite simple. I have long time no touching system affairs, and i changed used system from gentoo to ubuntu as well (for some reasons, not meant gentoo not good).
$ sudo apt-get install mysql-server
$ sudo /etc/init.d/mysql start
$ mysqladmin -u root password newPassword
done.