Category: Computer Tips
DHCP get back your old IP when you switch computer or network card
Modern DHCP server will identify clients using its MAC address, such that if you are offline (shutdown the client computer) for a short period, like a few hours, up to a few days, depends on the load of the dhcp server and the pool size, when you are back online again, you will get the […]
In chroot environment, screen works only for root
First the system has the following system mounting points /proc, /sys, /dev, /dev/shm, /dev/pts, mounted properly. However, in some OS, the file /usr/libexec/pt_chown has the permission -rws–x–x This seems not working in the chroot subsystem. By changing the permission of the file /$chroot_root/usr/libexec/pt_chown to -rwsr-xr-x screen works in chroot system.
run a list of files
command $(cat filelist)
sed replace return
sed ‘:a;N;$!ba;s/\n/ /g’ infile > outfile
When ssh: Warning: No xauth data; using fake authentication data for X11 forwarding.
The fix for this is pretty easy and clear – just do #unset DISPLAY before ssh-ing.
tar and rsync: Archive and Preserve SELinux Contexts, Extended Attributes, And ACLs
tar –selinux –acls –xattrs -cvfz file.tgz yourfiles Where, –selinux – Save the SELinux context to the archive called file.tgz. –acls – Save the ACLs to the archive called file.tgz. –xattrs – Save the user/root xattrs to the archive called file.tgz Please that it archive all extended attributes, including SELinux and ACLs. -c – Create a […]
Add a static route
route add -net x.x.x.0/24 gw y.y.y.y
Openvpn client start return failed but still working
linux version 2.1 – 2.3.2 Openvpn client start failed (shown), but interestingly it is still working. Workaround: Seems something is racing. add ; sleep 1 after $openvpn –daemon –writepid $piddir/$bn.pid –config $c –cd $work $script_security resolves this. This is to allow one more seconds for the daemon to return success signal.
SCSI commands
SCSI scan for single device: echo “c t l” > /sys/class/scsi_host/hosth/scan The older form of this command, echo “scsi add-single-device 0 0 0 0” > /proc/scsi/scsi, is deprecated. SCSI delete single device: echo 1 > /sys/class/scsi_device/h:c:t:l/device/delete The old method echo “scsi remove-single-device h c t l” > /proc/scsi/scsi is depreciated.
Converting RHEL6 to CentOS6
yum clean all mkdir CentOS_downloads cd CentOS_downloads wget http://www.gtlib.gatech.edu/pub/centos/6.4/os/x86_64/Packages/centos-release-6-4.el6.centos.10.x86_64.rpm wget http://www.gtlib.gatech.edu/pub/centos/6.4/os/x86_64/RPM-GPG-KEY-CentOS-6 wget http://www.gtlib.gatech.edu/pub/centos/6.4/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm wget http://www.gtlib.gatech.edu/pub/centos/6.4/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm wget http://www.gtlib.gatech.edu/pub/centos/6.4/os/x86_64/Packages/yum-utils-1.1.30-14.el6.noarch.rpm rpm –root /yourroot/ –import RPM-GPG-KEY-CentOS-6 rpm –root /yourroot/ -e –nodeps redhat-release-server rpm –root /yourroot/ -e yum-rhn-plugin rhn-check rhnsd rhn-setup rhn-setup-gnome rpm –root /yourroot/ -Uvh –force *.rpm yum –installroot=/yourroot/ upgrade