Install whois CentOS / Ubuntu

jwhois is a whois client that accepts both traditional and finger-style queries. You can install the same using yum in Centos and apt-get in Ubuntu systems

Centos  :

yum -y install jwhois

Ubuntu

sudo apt-get install jwhois

 

In Centos/ Redhat systems you can run the command whois

# whois ajayadas.com
[Querying whois.verisign-grs.com]
[Redirected to whois.godaddy.com]
[Querying whois.godaddy.com]
[whois.godaddy.com]
Domain Name: AJAYADAS.COM
Registry Domain ID: 1545424198_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.godaddy.com
Registrar URL: http://www.godaddy.com
Update Date: 2013-05-12T10:55:01Z
Creation Date: 2009-03-04T22:04:18Z
Registrar Registration Expiration Date: 2017-03-04T22:04:18Z
Registrar: GoDaddy.com, LLC
Registrar IANA ID: 146

 

But in Ubuntu based systems you have to run jwhois

$ jwhois ajayadas.com

 

 

 

Pure-FTP / How to Create User or reset Password

Pure-FTP is one of the stable , Secure  FTP server , Very easy to install from source or using YUM in CentOS,  or In Case of Ubuntu just run “sudo Apt-get install pure-ftpd-common pure-ftpd.

 

After Installation, I have noticed it has a Database of it’s own for handling users and a bunch of nice commands to manage them. here it goes

 

 Create New FTP User

Open the terminal and run this command:

ajay~# pure-pw useradd ajay -u ftpusers  -g ftpusers -d /var/www/html/ajay

Users are stored by default in this location: /etc/pure-ftpd/pureftpd.passwd , Here -u ftpusers and -g ftpusers represent the corresponding Linux user, This will help you for the permissions and stuff later.

After creating a user, you have to update this database with this command:

ajay~# pure-pw mkdb

If you want to get information about a specific FTP user, use this command:

ajay~# pure-pw show ajay

To list all FTP users,

run this command:

ajay~#  pure-pw list

Reset FTP User Password

If you a user password is forgotten, you can reset it with the following command:

ajay~#  pure-pw passwd ajay

Dont forget to update  your database with this command:

ajay~# pure-pw mkdb

 

Cool , now feel bit more powerful. have a great time ahead

Network interface settings – CentOS

Configuration of the “/etc/sysconfig/network-scripts/ifcfg-eth0” file

In this file, you would find your basic network device configuration. Here, ifcfg-eth0 is the first Ethernet device; ifcfg-eth1 would be the second Ethernet NIC (network interface card), and so forth. In this file, you can have quite a few settings.

Directives Required / Optional Expected Settings Comment
DEVICE= Required ethX You must have this entry specifying the Linux device name.
ONBOOT= Optional yes / no Start the device on boot? This will default to yes.
BOOTPROTO= Required static / dhcp / none Static hard set our IP, or do we want a dhcp assignment? “dhcp”, “none” is the same as static.
IPADDR= Optional IP address of machine The address we want if we are setting a static IP for the interface.
NETMASK= Optional Subnet mask Required for static IPs. The subnet mask.
NETWORK= Optional Network address Recommended for static IPs. The network that we are on.
BROADCAST= Optional Network broadcast address Recommended for static IPs. The broadcast address.
HWADDR= Optional Device MAC address The MAC address of our network card. Normally provided by the Anaconda installer at install time.
USERCTL= Optional yes / no Allow normal non-administrative user to take down and bring up the device. Defaults to “no”.
GATEWAY= Optional IP address of gateway The network gateway IP address.

Not all of these are necessary for proper operation, and the order they are in is irrelevant. I prefer to specify the additional directives of NETWORK and BROADCAST in my /etc/sysconfig/network-scripts/ifcfg-eth0 on machines that I want to have a hard-set IP address, mainly servers of any sort. If you want to use a DHCP-assigned address, your /etc/sysconfig/network-scripts/ifcfg-eth0 file would look something like this:

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=08:00:27:4B:3B:06
ONBOOT=yes

Bringing up interface eth0: Device eth0 does not seem to be preset, delaying initialization – centos 6

This normally happens when you clone the machine and boot from another hardware

Bringing up interface eth0: Device eth0 does not seem to be preset, delaying initialization.      [FAILED]

To fix this, we need to update udev’s mapping rules to point the eth0 definition to the device with the correct MAC address. Open the file /etc/udev/rules.d/70-persistent-net.rules. You should see something similar to what is below:

view source
print?
01 # This file was automatically generated by the /lib/udev/write_net_rules
02 # program, run by the persistent-net-generator.rules rules file.
03 #
04 # You can modify it, as long as you keep each rule on a single
05 # line, and change only the value of the NAME= key.
06
07 # PCI device 0x8086:0x100f (e1000) (custom name provided by external tool)
08 SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:50:56:9c:00:16″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″
09
10 # PCI device 0x8086:0x100f (e1000) (custom name provided by external tool)
11 SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:50:56:9c:00:18″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth1″

As you can see there are two PCI ethernet adapters present.

 

1 # This file was automatically generated by the /lib/udev/write_net_rules
2 # program, run by the persistent-net-generator.rules rules file.
3 #
4 # You can modify it, as long as you keep each rule on a single
5 # line, and change only the value of the NAME= key.
6
7 # PCI device 0x8086:0x100f (e1000) (custom name provided by external tool)
8 SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:50:56:9c:00:18″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″

You’ll also want to update the /etc/sysconfig/network-scripts/ifcfg-eth0 file to reflect the correct MAC address. Then, after a quick system restart your eth0 adapter will be back up.

 

Install and configure DNS bind chroot in centos 6

1. Install Bind Chroot DNS server :

[root@centos64 ~]# yum install bind-chroot bind -y

2. Copy all bind related files to prepare bind chrooted environments :

[root@centos64 ~]# cp -R /usr/share/doc/bind-*/sample/var/named/* /var/named/chroot/var/named/

3. Create bind related files into chrooted directory :

[root@centos64 ~]# touch /var/named/chroot/var/named/data/cache_dump.db
[root@centos64 ~]# touch /var/named/chroot/var/named/data/named_stats.txt
[root@centos64 ~]# touch /var/named/chroot/var/named/data/named_mem_stats.txt
[root@centos64 ~]# touch /var/named/chroot/var/named/data/named.run
[root@centos64 ~]# mkdir /var/named/chroot/var/named/dynamic
[root@centos64 ~]# touch /var/named/chroot/var/named/dynamic/managed-keys.bind

4. Bind lock file should be writeable, therefore set the permission to make it writable as below :

[root@centos64 ~]# chmod -R 777 /var/named/chroot/var/named/data
[root@centos64 ~]# chmod -R 777 /var/named/chroot/var/named/dynamic

5. Set if you do not use IPv6 :

[root@centos64 ~]# echo 'OPTIONS="-4"' >> /etc/sysconfig/named

6. Copy /etc/named.conf chrooted bind config folder :

[root@centos64 ~]# cp -p /etc/named.conf /var/named/chroot/etc/named.conf

7.Configure main bind configuration in /etc/named.conf. Append the ehowstuff.local information to the file :

[root@centos64 ~]# vi /var/named/chroot/etc/named.conf

a. Add bind DNS IP addresses :

..
listen-on port 53 { 127.0.0.1;192.168.2.62;192.168.2.63; };
..

b. Create forward and reverse zone :

..
..
zone "ehowstuff.local" {
    type master;
    file "ehowstuff.local.zone";
};

zone "2.168.192.in-addr.arpa" IN {
        type master;
        file "192.168.2.zone";
};
..
..

Full configuration for named.conf :

//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//

options {
        listen-on port 53 { 127.0.0.1;192.168.2.62;192.168.2.63; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query     { localhost; };
        recursion yes;

        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;

        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";

        managed-keys-directory "/var/named/dynamic";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
        type hint;
        file "named.ca";
};

zone "ehowstuff.local" {
    type master;
    file "ehowstuff.local.zone";
};

zone "2.168.192.in-addr.arpa" IN {
        type master;
        file "192.168.2.zone";
};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

8. Create Forward and Reverse zone files for domain ehowstuff.local.

a) Create Forward Zone :

[root@centos64 ~]# vi /var/named/chroot/var/named/ehowstuff.local.zone
;
;       Addresses and other host information.
;
@       IN      SOA     ehowstuff.local. hostmaster.ehowstuff.local. (
                               2013042201      ; Serial
                               43200      ; Refresh
                               3600       ; Retry
                               3600000    ; Expire
                               2592000 )  ; Minimum

;       Define the nameservers and the mail servers

               IN      NS      ns1.ehowstuff.local.
               IN      NS      ns2.ehowstuff.local.
               IN      A       192.168.2.62
               IN      MX      10 mail.ehowstuff.local.

centos64           IN      A       192.168.2.62
mail            IN      A       192.168.2.62
ns1              IN      A       192.168.2.62
ns2              IN      A       192.168.2.63

b) Create Reverse Zone :

[root@centos64 ~]# vi /var/named/chroot/var/named/192.168.2.zone
;
;       Addresses and other host information.
;
@       IN      SOA     ehowstuff.local. hostmaster.ehowstuff.local. (
                               2013042201      ; Serial
                               43200      ; Refresh
                               3600       ; Retry
                               3600000    ; Expire
                               2592000 )  ; Minimum

2.168.192.in-addr.arpa. IN      NS      centos64.ehowstuff.local.

62.2.168.192.in-addr.arpa. IN PTR mail.ehowstuff.local.
62.2.168.192.in-addr.arpa. IN PTR ns1.ehowstuff.local.
63.2.168.192.in-addr.arpa. IN PTR ns2.ehowstuff.local.

9. Start Bind service :

[root@centos64 ~]# /etc/init.d/named start
Generating /etc/rndc.key:                                  [  OK  ]
Starting named:                                            [  OK  ]

10. Configure Bind auto start at boot :

[root@centos64 ~]# chkconfig --levels 235 named on

11. Test and verify Bind DNS setup :
a. Test and verify using host command :

[root@centos64 ~]# host -t ns ehowstuff.local
ehowstuff.local name server ns1.ehowstuff.local.
ehowstuff.local name server ns2.ehowstuff.local.
[root@centos64 ~]# host -t mx ehowstuff.local
ehowstuff.local mail is handled by 10 mail.ehowstuff.local.

b. Test and verify using nslookup command :

[root@centos64 ~]# nslookup
> set type=any
> ehowstuff.local
Server:         192.168.2.62
Address:        192.168.2.62#53

ehowstuff.local
        origin = ehowstuff.local
        mail addr = hostmaster.ehowstuff.local
        serial = 2013042201
        refresh = 43200
        retry = 3600
        expire = 3600000
        minimum = 2592000
ehowstuff.local nameserver = ns1.ehowstuff.local.
ehowstuff.local nameserver = ns2.ehowstuff.local.
Name:   ehowstuff.local
Address: 192.168.2.62
ehowstuff.local mail exchanger = 10 mail.ehowstuff.local.
> exit

c. Test and verify using dig command :

[root@centos64 ~]# dig ehowstuff.local

; < <>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.4 < <>> ehowstuff.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER< <- opcode: QUERY, status: NOERROR, id: 6958
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2

;; QUESTION SECTION:
;ehowstuff.local.               IN      A

;; ANSWER SECTION:
ehowstuff.local.        2592000 IN      A       192.168.2.62

;; AUTHORITY SECTION:
ehowstuff.local.        2592000 IN      NS      ns1.ehowstuff.local.
ehowstuff.local.        2592000 IN      NS      ns2.ehowstuff.local.

;; ADDITIONAL SECTION:
ns1.ehowstuff.local.    2592000 IN      A       192.168.2.62
ns2.ehowstuff.local.    2592000 IN      A       192.168.2.63

;; Query time: 1 msec
;; SERVER: 192.168.2.62#53(192.168.2.62)
;; WHEN: Wed Apr  3 00:03:40 2013
;; MSG SIZE  rcvd: 117


courtesy: ehowstuff.com/how-to-install-and-configure-bind-chroot-dns-server-on-centos-6-4-vps/
WP Twitter Auto Publish Powered By : XYZScripts.com