Monday, August 3, 2015

DNS Records



DNS Record Types:-

A         - Returns a 32-bit IPv4 address and its this is used more frequestly

AAAA - Returns a 128-bit IPv6 address

CNAME - Alias is a name of other name, ie mail.domain.com ref to smtp.domain.com

MX         - this is mainly used by mail daemons, this record used to lookup mail server information for a domain and can send a mail to it.

PTR         - This is an reverse DNS Lookup

SOA - This holds Authoritative information

SRV - This will return lookup based on protocol

TXT - returns human readable text information, this is being used to store hardware information for the host.

AXFR - This is userd for transfering record between master and slave servers.

Saturday, February 4, 2012

How To Find 32 bit or 64 bit in linux

Kernel version check



Type the following command at the terminal, run:
$ uname -a
Output:
Linux hostname 2.6.32-33-generic-pae #72-Ubuntu SMP Fri Jul 29 22:06:29 UTC 2011 i686 GNU/Linux

(or )

$ uname -m
Output:
i686


x86_64 GNU/Linux indicates that you've a 64bit Linux kernel running. If you use see i386/i486/i586/i686 it is a 32 bit kernel.

$ getconf WORK_BIT
if you get 32 its 32bit kernel
if you get 64 its 64bit kernel

$ file /usr/bin/lsof
you could see the compilation version of the binary

/usr/bin/lsof: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped

How to find out CPU is 32bit or 64bit?



type the following command and if you see lm in output, you have a 64 bit CPU based system:

$ grep flags /proc/cpuinfo

Output:

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm tpr_shadow vnmi flexpriority
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm tpr_shadow vnmi flexpriority

CPU Modes:
lm flag means Long mode(lm) cpu - 64 bit CPU
Real mode 16 bit CPU
Protected Mode is 32-bit CPU

To find system support Hyper-v

$ grep vmx /proc/cpuinfo
Output:

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm tpr_shadow vnmi flexpriority
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm tpr_shadow vnmi flexpriority


$ lshw
 command shows mainboard configuration, CPU version and speed, cache
       configuration, bus speed, etc

Monday, November 7, 2011

Ubuntu-How to enable cgi support on apache

first of all, install apache2:
1)aptitude install apache2
2)make sure you have /usr/lib/apache2/modules/mod_cgi.so
3)add following line to your /etc/apache2/sites-enabled/default (or whatever the default filename is):
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
<Directory /var/www/cgi-bin>
AllowOverride None
Option +Execcgi -MultiViews +SymlinksIfOwnerMatch
order allow,deny
allow from all
</Directory>
4)mkdir /var/www/cgi-bin
5)put this script in there:
#!/usr/bin/perl
print "Content-type: text/plain\n\n";
print "Hello world";
6)chmod +x /var/www/cgi-bin/yourscript.cgi

7)restart apache2:
/etc/init.d/apache2 restart

Thursday, August 18, 2011

how to configure pxe server?

Pxe server with various OSes:-
how to do pxe server(network boot)


DHCP
[root@fcld ]# yum install dhcp
[root@fcld ]# nano /etc/dhcpd.conf

ddns-update-style interim;
not authoritative;
option domain-name "codigolibre.org";
option domain-name-servers 196.3.81.132, 200.88.127.22;
option subnet-mask 255.255.255.0;
subnet 10.0.200.0 netmask 255.255.255.0
{
authoritative;
range 10.0.200.50 10.0.200.100;
allow unknown-clients;
allow booting ;
allow bootp ;
next-server 10.0.200.1;
filename "pxelinux.0";
}

Note: The 10.0.200.1 direction belongs to the same PXE server.

VSFTP
[root@fcld ]# yum install vsftp

TFTP
[root@fcld ]# yum install tftp-server
[root@fcld ]# nano /etc/xinetd.d/tftp
disable=no

Make the following directories
[root@fcld ]# mkdir /tftpboot/
[root@fcld ]# mkdir /tftpboot/images
[root@fcld ]# mkdir /tftpboot/pxelinux.cfg
[root@fcld ]# chmod -R 777 /tftpboot/

Copy those files to /tftpboot/
[root@fcld ]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
[root@fcld ]# cp /usr/lib/syslinux/menu.c32 /tftpboot/

Create and edit the PXE menu config file.
[root@fcld]# nano /tftpboot/pxelinux.cfg/default
DEFAULT menu.c32
PROMPT 0
TIMEOUT 600
MENU TITLE Servidor de Instalacion de la FCLD

Config each one of the distros.
a) CentOS 5

[root@fcld ]# mkdir /tftpboot/images/centos/5/i386
[root@fcld ]# mkdir /var/ftp/centos/5/i386
[root@fcld ]# mount -o loop -t iso9660 ~/Centos5.iso /mnt
[root@fcld ]# cp -R /mnt/* /var/ftp/centos/5/i386/
[root@fcld ]# cp /var/ftp/centos/5/i386/images/pxeboot/vmlinuz /tftpboot/images/centos/5/i386/
[root@fcld ]# cp /var/ftp/centos/5/i386/images/pxeboot/initrd.img /tftpboot/images/centos/5/i386/

Add Centos entry on PXE menu:
LABEL Centos 5 (DVD-i386)
KERNEL images/centos/5/i386/vmlinuz
APPEND vga=normal initrd=images/centos/5/i386/initrd.img ramdisk_size=32768
METHOD=ftp://10.0.200.1/centos/5/i386/

b) Fedora 11
[root@fcld ]# mkdir /tftpboot/images/fedora/11/i386
[root@fcld ]# mkdir /var/ftp/fedora/11/i386
[root@fcld ]# mount -o loop -t iso9660 ~/Fedora-11.iso /mnt
[root@fcld ]# cp -R /mnt/* /var/ftp/fedora/11/i386/
[root@fcld ]# cp /var/ftp/fedora/11/i386/vmlinuz /tftpboot/images/fedora/11/i386/
[root@fcld ]# cp /var/ftp/fedora/11/i386/initrd.img /tftpboot/images/fedora/11/i386/

Add fedora entry on PXE menu:
[root@fcld]# nano /tftpboot/pxelinux.cfg/default
LABEL Fedora Core 11
KERNEL images/fedora/11/i386/vmlinuz
APPEND vga=normal initrd=images/fedora/11/i386/initrd.img ramdisk_size=32768
METHOD=ftp://10.0.200.1/fedora/11/i386/

c) Ubuntu 9.10
[root@fcld ]# mkdir /tftpboot/images/ubuntu-desktop
[root@fcld ]# mkdir /var/ftp/ubuntu-desktop
[root@fcld ]# mount -o loop -t iso9660 ~/Ubuntu-9.10.iso /mnt
[root@fcld ]# cp -R /mnt/* /tftpboot/images/ubuntu-desktop/
[root@fcld ]# cp -R /mnt/* /var/ftp/ubuntu-desktop/

Add the ubuntu entry to PXE menu:
[root@fcld]# nano /tftpboot/pxelinux.cfg/default
LABEL Ubuntu 9.10 Karmic Koala
KERNEL images/ubuntu-desktop/casper/vmlinuz
APPEND vga=normal boot=casper netboot=nfs nfsroot=10.0.200.1:/var/ftp/ubuntu-desktop/
initrd=images/ubuntudesktop/casper/initrd.gz ramdisk_size=32768

Edit the file /etc/exports and add:
[root@fcld ]# nano /etc/exports
/var/ftp/ubuntu-desktop 10.0.200.0/255.255.255.0(rw)

c) Clonezilla 1.2.2
[root@fcld ]# mkdir /tftpboot/images/clonezilla
[root@fcld ]# mkdir /var/ftp/clonezilla
[root@fcld ]# mount -o loop -t iso9660 ~/clonezilla-1.2.iso /mnt
[root@fcld ]# cp -R /mnt/* /tftpboot/images/clonezilla/
[root@fcld ]# cp -R /mnt/* /var/ftp/clonezilla/

Add entry for clonezilla on PXE menu:
[root@fcld]# nano /tftpboot/pxelinux.cfg/default

LABEL Clonezilla 1.2.2
KERNEL images/clonezilla/live/vmlinuz1
APPEND vga=normal initrd=images/clonezilla/live/initrd1.img boot=live union=aufs
netboot=nfs nfsroot=10.0.200.1:/var/ftp/clonezilla/ ramdisk_size=32768

Edit the file /etc/exports que le pertenece and add:
[root@fcld ]# nano /etc/exports
/var/ftp/clonezilla 10.0.200.0/255.255.255.0(rw)

Start or restart the daemons
[root@fcld ]# service vsftpd restart
[root@fcld ]# service xinetd restart
[root@fcld ]# service nfs restart
[root@fcld ]# service dhcpd restart

Make the daemons start on boot
[root@fcld ]# chkconfig vsftpd --level 345 on
[root@fcld ]# chkconfig xinetd --level 345 on
[root@fcld ]# chkconfig nfs --level 345 on
[root@fcld ]# chkconfig dhcpd --level 345 on

NOTE: After completion of all relevant daemons start, remember to initialize the DHCPD requires a network card configured on the same subnet that the server work.


content from nixcraft

Monday, August 15, 2011

limit Unix command to user


                                                                     
                                             
we want to limit the activities or command to run for specific user then, how to limit a shell? here are the steps to create limited shell.

Add a user who can execute some specific commands.

1. Create a link named ‘rbash’ from bash.

# ln -s /bin/bash /opt/rbash

2. Add a user that his default shell is rbash and set he can execute only ‘ping’.

# useradd lsuser -s /opt/rbash
# passwd lsuser
# mkdir /home/lsuser/bin
# ln -s /bin/ping /home/lsuser/bin/ping
# chown root. /home/lsuser/.bash_profile
# chmod 755 /home/lsuser/.bash_profile
# vi /home/lsuser/.bash_profile

  # change PATH like follows
  PATH= $HOME/bin

3. Login with the test user.

$ cd
-rbash: cd: restricted # denied
$ ls
-rbash: ls: command not found # none
$ ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.045 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.008 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.008 ms

— localhost ping statistics —
3 packets transmitted, 3 received, 0% packet loss, time 2157ms
rtt min/avg/max/mdev = 0.008/0.020/0.045/0.017 ms  # executed

webmin

Webmin is a program that simplifies the process of managing a Linux or Unix system.

Webmin lets you perform these tasks through an easy to use web interface, and automatically updates all of the required configuration files for you. This makes the job of administering your system much easier.

Some of the things that you can do with Webmin are :

1) Create, edit and delete Unix login accounts on your system.
2) Export files and directories to other systems with the NFS protocol.
3) Set up disk quotas to control how much space users can use up with their files.
4) Install, view and remove software packages in RPM and other formats.
5) Change your system’s IP address, DNS settings and routing configuration.
6) Set up a firewall to protect your computer, or to give hosts on an internal LAN access to the Internet.
7) Create and configure virtual web servers for the Apache webserver.
8) Manage databases, tables and fields in a MySQL or PostgreSQLdatabase server.
9) Share files with Windows systems by configuring Samba.

These are just a few of the available functions. Webmin lets you configure almost all of the common services and popular servers on Unix systems, all using a simple web interface. It protects you from the syntax errors and other mistakes that are often made when editing configuration files directly, and warns you before potentially dangerous actions.

Because Webmin is accessed though a web browser, you can login to it from any system that is connected to yours through a network. There is absolutely no difference between running it locally and running it remotely, and it is much easier to use over the network than other graphical configuration programs.

Thursday, January 20, 2011

How to install a new kernel in Linux box?


(commands are mentioned in bold letters)
Step1:  download kernel (linux-2.6.37.tar.bz2) from kernel.org
           We should aware of that even numbered version (ex 2.6.38) release is the stable one
           An odd version (ex 2.6.37) number which is not stable
Step 2: extract tar archive in /usr/src or any where you wish
             tar –xjvf linux-2.6.37.tar.bz2 –c /usr/src
step3: yum install gcc
Step4:  cd /usr/src/
Step5: make manuconfig   
           There we can find graphical window for kernel tuning
           This is the major tool used to tune the kernel for our convenience
Step6: make
Step7: make modules
Step8: make modules_install
Step9: make install  //it will take several minutes
Step10: don’t forget to hash out old kernel in /boot/grub/grub.conf
              Reboot