2009/08/26

How to access outside the chrooted directory

Symbolic links do not work when pointing outside the default root (chrooted location) directory. To get around this limitation, it is possible to remount directories into chrooted location. One can
also remount a single file (on a single file).

as of the 2.4.0 kernel:
# mount --bind olddir newdir

also putting this line into /etc/fstab makes it permanent.
/my/old/dir /my/new/dir none bind 0 0

Recursively copy

Recursively copy a directory into another place with preserving mode, ownership and timestamps and redirect the names of erroneous ones into a file(copy_error.txt).

# cp -R --preserve /old_dir/* /new_dir/ >& copy_error.txt

passwordless ssh

on the first and second server:

test ~# mkdir ~/.ssh
test ~# chmod 755 ~/.ssh
test ~# /usr/bin/ssh-keygen -t rsa
test ~# /usr/bin/ssh-keygen -t dsa
test ~# cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
test ~# cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

on the first server:

test ~# ssh test@server2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
test ~# ssh test@server2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
test ~# chmod 644 ~/.ssh/authorized_keys

on the second server:

test ~# ssh test@server1 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
test ~# ssh test@server1 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
test ~# chmod 644 ~/.ssh/authorized_keys

verification:

on the first server:
test ~# ssh test@server2 ls -al

on the second server:
test ~# ssh test@server1 ls -al

Installing rpm packages with "yum localinstall"

If rpm packages are installed via "yum localinstall", then dependent packages are also installed automatically. For instance:

# yum localinstall truecrypt-5.1-1.i386.rpm -y

This command tries to install truecrypt, but this rpm needs some others. Then, yum will find and install these dependent rpm's for you silently.

Converting a .p7b signed cert to .pem

openssl pkcs7 -inform DER -in server-cert.p7b
-print_certs -text -out /etc/apache2/ssl.crt/server.crt