Thursday, July 17, 2014

Deleting Single Iptables Rule

I look at my iptables rules
iptables -L
and get this
Chain INPUT (policy ACCEPT)
target     prot opt source               destination        
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere           
ACCEPT     all  --  anywhere             anywhere           

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination        

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

For example I make rule to accept port 80, so I do this
iptables -I INPUT 3 -p tcp --dport 80 -j ACCEPT
and then iptables -L give us this
Chain INPUT (policy ACCEPT)
target     prot opt source               destination        
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere           
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:http
ACCEPT     all  --  anywhere             anywhere
Look at third line, there is rule for accepting connection from port 80. The rule inserted in third line because I use 3 in this rule
 iptables -I INPUT 3 -p tcp --dport 80 -j ACCEPT
If we want to delete this single rule, do
iptables -D INPUT 3
So iptables -L give us
Chain INPUT (policy ACCEPT)
target     prot opt source               destination        
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere           
ACCEPT     all  --  anywhere             anywhere
Source:
http://major.io/2007/02/09/delete-single-iptables-rules/

Upgrade Ubuntu 12.04 to Ubuntu 14.04

Ensure that your Ubuntu is up to date
sudo apt-get update && sudo apt-get upgrade -y
Install update manager core
sudo apt-get install update-manager-core -y
 Upgrade your Ubuntu
sudo do-release-upgrade -d
And follow next instruction carefully.....

Source:
http://www.namhuy.net/2853/upgrade-ubuntu-12-04-lts-ubuntu-14-04-lts.html

Wednesday, July 16, 2014

Grant Root Access To Additional User FreeBSD

Just add user to group wheel with this
pw user mod username -G wheel
For example I add user akhfa to wheel group
pw user mod akhfa -G wheel
If you do it well, if you type
groups akhfa
you will get
akhfa       wheel
Source:
http://www.cyberciti.biz/tips/freebsd-becoming-super-user-su-or-enabling-su-access-to-user.html

Install Nano On FreeBSD

Go to nano directory
cd /usr/ports/editors/nano
Compile and install nano
make install clean
Make symbolic link
ln -s /usr/local/bin/nano /usr/bin/nano
Source:
http://blog.bobbyallen.me/2012/05/28/how-to-install-nano-on-freebsd/

Updating FreeBSD

To update your FreeBSD, do this
freebsd-update fetch
freebsd-update install
If something wrong, you can cancel update by
freebsd-update  rollback
Source:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/updating-upgrading-freebsdupdate.html

Tuesday, July 8, 2014

Install Htop On CentOS

Htop, a process manager based on command line interface, is a powerful tool to manage process from terminal.


Sunday, July 6, 2014

Enable Remote Access To Mysql Database Server Or On VPS Ubuntu

If you want to make application with remote database, you will need to grant database on your server to be accessed by your application. Now I will tell you how to grant access so your application can use mysql from your server.

Friday, July 4, 2014

Fix GPG Error Ubuntu

Sometimes you can find like this on terminal when updating repository
W: There is no public key available for the following key IDs:
3B4FE6ACC0B21F32
If you found it, fix with this
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
And then try "apt-get update" again

Install Dropbear And Change Dropbear Port On Ubuntu

Make sure that your Ubuntu is up to date
sudo apt-get update && sudo apt-get upgrade -y
To install Dropbear, run this on terminal
sudo apt-get install dropbear
 To start and change dropbear port, make sure nano was installed and do this