Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Wednesday, April 22, 2015

Completely remove nf_conntrack from kernel

1. Remove the following line, if it exists, in /etc/sysconfig/iptables-config
   IPTABLES_MODULES="ip_conntrack_netbios_ns"

2. Stop iptables
   iptables -F

3. Remove the related modules
   modprobe -r xt_NOTRACK nf_conntrack_netbios_ns nf_conntrack_ipv4 xt_state
   modprobe -r iptable_nat ipt_MASQUERADE nf_nat nf_defrag_ipv4
   modprobe -r nf_conntrack

Wednesday, September 10, 2014

Login to remote server with private key

1. Generate private/public keys
   ssh-keygen -t rsa

2. Upload the public key (id_rsa.pub) to remote server
   scp ~/.ssh/id_rsa.pub howard@remoteServer:~/.ssh/
   or
   cat ~/.ssh/id_rsa.pub | ssh howard@remoteServer "cat >> ~/.ssh/authorized_keys" 

3. Login to remote server and append the key
   ssh howard@remoteServer
   mkdir .ssh
   chmod 700 .ssh
   cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
   chmod 600 ~/.ssh/authorized_keys
   rm -rf id_rsa.pub

4. It's done!



To convert RSA private key to pem file, run the command below:
openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem

Thursday, July 3, 2014

vi/vim settings

/etc/virc for vi
/etc/vimrc for vim
~/.vimrc

syntax on
set autoindent
set number

set sw=4
set tabstop=4
set cindent

Sunday, June 22, 2014

Linux mount NAS with NFS type

showmount -e IPAddress

sudo mount -t nfs IPAddress:/ShareFolder /MountPoint

Convert Big5 and UTF-8

convmv: http://www.j3e.de/linux/convmv/

convmv -f big5 -t utf-8 -r --notest folder

-f: from
-t: to
-r: recursive
--notest: do it. If not added, it only tests it

Friday, March 2, 2012

command for listing all the shared libraries used by an ARM-base executable

. For ARM-base executable, use
arm-none-linux-gnueabi-objdump -x executable_name | grep NEEDED

. For Intel-base executable, use
ldd executable_name

Friday, October 14, 2011

Prevent SIGPIPE from crashing the program

To do so, add following code to your program.
   signal( SIGPIPE, SIG_IGN ) ;

If debugging with GDB, GDB captures it and paused the process. To avoid this, run following command in gdb. For detailed information about handle, type "handle help" in gdb.
   handle SIGPIPE nostop print pass

Monday, July 4, 2011

Launch application at Linux startup

Edit /etc/rc.d/rc.local and add your application
Ex. /usr/src/p2pd/p2pd.sh &

Monday, January 3, 2011

Steps to install Bugzilla on CentOS 5.4

1. Disable selinux
vi /etc/selinux/config
set SELINUX=disabled

2. Add one iptables rule to allow TCP port 80 for httpd
vi /etc/sysconfig/iptables
add following rule
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
service iptables restart

3. Install required components
yum install perl
yum install httpd
yum install mysql-server
yum install mysql
yum install php-mysql
yum install gcc
yum install cvs
yum install patchutils
yum install mysql-devel

4. Install bugzilla
cd /var/www
rmdir html
wget http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-3.6.3.tar.gz
tar xzvf bugzilla-3.6.3.tar.gz
mv bugzilla-3.6.3 html

5. Apache configuration
vi /etc/httpd/conf/httpd.conf
find < directory "/var/www/html" > section and ..
1. Append ExecCGI to "Optoins"
2. Add "DirectoryIndex index.cgi index.html" under "Options"

Uncomment AddHandler cgi-script .cgi
service httpd start

6. Check if all the required perl modules are installed
./checksetup.pl --check-modules
to install all missing modules, run following command
perl install-module.pl --all
once doen, check modules again to see if it's ok
if DBD-mysql is not ok, run "perl install-module.pl DBD:mysql" to install it

7. Create localconfig
./checksetup.pl
modify the $db_pass of localconfig
vi ./localconfig
$db_pass = "howard"

8. Increase attachment size to 3MB, for example.
vi /etc/my.cnf
add "max_allowed_packet=3M"
service mysqld restart

9. Create mysql user
mysql -u root -p
GRANT SELECT, INSERT, UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES, CREATE TEMPORARY TABLES, DROP, REFERENCES ON bugs.*TO bugs@localhost IDENTIFIED BY 'howard';
FLUSH PRIVILEGES;

10. Create bugzilla database and administrator account
run ./checksetup.pl and follow the instructions to create the administrator account
once done, run ./checksetup.pl again to make sure everything is ok

Now bugzilla should be ready to go, connect to it via browser and complete the one time setup.
That's all.

Notes:
. To fix "Error when close pipe to /usr/lib/sendmail (while creating account), you have to allow SMTP connection in SELinux by run "setsebool -P httpd_can_sendmail 1" without quotes.

Check clients which connect to Mac OS X Wi-Fi Internet Sharing

arp -i bridge100 -a bridge100 may be different on your Mac OSX