Tuesday, October 26, 2010

Xen's domU always depend on dom0's time and date

By default, the time and date in domU is following dom0. To reset that, below are just what you have to do to decouple the domU's date from dom0

On dom0:

Append xen.independent_wallclock=1 to /etc/sysctl.conf

# echo "xen.independent_wallclock=1"  >> /etc/sysctl.conf
Activate the change
# sysctl -p
Append extra="clocksource=jiffies" to the domU's configuration file.
# echo "extra=\"clocksource=jiffies\"" >> /etc/xen/<domU's name>.cfg 


On domU:

Append xen.independent_wallclock=1
# echo "xen.independent_wallclock=1"  >> /etc/sysctl.conf 
Activate the change
# sysctl -p 
Append jiffies to /sys/devices/system/clocksource/clocksource0/current_clocksource
# echo "jiffies" >> /sys/devices/system/clocksource/clocksource0/current_clocksource

Now you can set your domU's date using "date" command or "ntpdate" to get update from ntp servers.

That's all folks

Friday, October 15, 2010

Using ssh as proxy

To create ssh tunnel is very easy. Let's say you want to use machine1.example.com as your ssh proxy, your username is foo and you choose port 8080 on your localhost to be your local proxy port. Type below command on your localhost:

$ ssh -D 8080 foo@machine1.example.com
Once connected, set your browser to use Socks5 proxy on port 8080 on your local machine. For firefox, the setting is "Tools -> Options -> Advanced -> Network -> Settings -> Manual proxy configuration" and follow below picture for the proxy setting. Just make sure to keep the ssh connection connected to reap the ssh proxy benefits :)



That's all :)

Cygwin man search problem

If you are a windows user, and you use cygwin, there is a problem with man page. The search function is a bit weird, where it cannot find something like "-D" in ssh man page. To overcome this, you have to set the LANG environment variable to c. To do this, just add export LANG=c to your .bashrc:

$ echo "export LANG=c" >> .bashrc

That's all folks :)

Thursday, October 7, 2010

Forcing user to change password the first time they log in

If you are creating new user in your machine, and you would like them to change password the first time they login, using command chage is the way. Let's say our user is foo.

# chage -d 0 foo
where -d is for lastday. When we set it to 0, it will ask for password change the first time foo logs in.

That's all folks :)