About Me

My photo
Hi Friends, I am Sandeep CC and some people know me as System Administrator. I have started my professional career from 2008. I have been working as System Administrator on Linux Server and Windows Client. I am here to share my Knowledge in which I have experienced and which I have come across till now, It could be help to you people. In case anything wrong or any improvements in my post steps, Please comment to the post, Feel free to contact me by posting comments on this blog. Thanks and Regards, Sandeep CC

Monday, March 29, 2010

Configure MySQL On REDHAT LINUX-4



Configuration Mysql on Redhat Linux4.

Setup:

Server: sandeeplinux3 (192.168.1.11 Local Network IP)

Requirement:

mysqlclient10-3.23.58-4.RHEL4.1 (default installed)
mysql-4.1.12-3.RHEL4.1 (default installed)
mysql-server-4.1.12-3.RHEL4.1 (Need to install)
mysql-4.1.12-3.RHEL4.1 (default installed)
perl-DBD-MySQL-2.9004-3.1 (Need to install)

Download Required Packages From RHEL4 CD:
(All packages are available on 4th CD)
[root@sandeeplinux3 ~]# cd /media/cdrecorder/
[root@sandeeplinux3 cdrecorder]#
[root@sandeeplinux3 RPMS]# ls -ltr mysql-server*
-rw-r--r-- 210 root root 2967401 Sep 13 2005 mysql-server-4.1.12-3.RHEL4.1.x86_64.rpm
[root@sandeeplinux3 RPMS]# cp mysql-server-4.1.12-3.RHEL4.1.x86_64.rpm /root/IMP_rpm_packages/
[root@sandeeplinux3 RPMS]# ls -ltr perl-DBD*
[root@sandeeplinux3 RPMS]# cp perl-DBD-MySQL-2.9004-3.1.x86_64.rpm /root/IMP_rpm_packages/
[root@sandeeplinux3 RPMS]# cd
[root@sandeeplinux3 ~]#

Note: Need to Install 1st DBD-MySQL package or else while installing mysql-server package it will give warn massage/error, so need to install must DBD-MySQL package before mysql-server.

Installation Of Required Packages:
[root@sandeeplinux3 IMP_rpm_packages]# rpm -i perl-DBD-MySQL-2.9004-3.1.x86_64.rpm
warning: perl-DBD-MySQL-2.9004-3.1.x86_64.rpm: V3 DSA signature: NOKEY, key ID db42a60e
[root@sandeeplinux3 IMP_rpm_packages]# rpm -i mysql-server-4.1.12-3.RHEL4.1.x86_64.rpm
warning: mysql-server-4.1.12-3.RHEL4.1.x86_64.rpm: V3 DSA signature: NOKEY, key ID db42a60e
[root@sandeeplinux3 IMP_rpm_packages]#

Start Services:
[root@sandeeplinux3 IMP_rpm_packages]# chkconfig mysqld on
[root@sandeeplinux3 IMP_rpm_packages]# service mysqld start
Initializing MySQL database: [ OK ]
Starting MySQL: [ OK ]
[root@sandeeplinux3 ~]# service mysqld status
mysqld (pid 2677) is running...
[root@sandeeplinux3 ~]#

Creating Mysql Root Account & Password for 1st time:
[root@sandeeplinux3 ~] # mysqladmin -u root password

Restore root password On Mysql (In case of forgot the password or misplaced):
[root@sandeeplinux3 ~]# service mysqld stop
Stopping MySQL: [ OK ]

[root@sandeeplinux3 ~]# mysqld_safe --skip-grant-tables --skip-networking &
[1] 3912
[root@sandeeplinux3 ~]# Starting mysqld daemon with databases from /var/lib/mysql
(Ctrl+C)

[root@sandeeplinux3 ~]# mysql -u root [In safe mode enter without password as root account)

mysql> use mysql

mysql> UPDATE user SET Password=PASSWORD("newpassword") WHERE User="root";

mysql> exit

[root@sandeeplinux3 ~]# service mysqld restart
STOPPING server from pid file /var/run/mysqld/mysqld.pid
100311 12:05:05 mysqld ended

Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]
[1]+ Done mysqld_safe --skip-grant-tables –skip-networking

[root@sandeeplinux3 ~]# mysql -u root -p
Enter password: (Give New Password)

Change/Update the Mysql root Password:
[root@sandeeplinux3 ~]# mysqladmin -u root -p'oldpassword' password newpassword

Change Mysql Password for Users:
[root@sandeeplinux3 ~]# mysqladmin -u xyz -p'oldpassword' password newpassword
Create Normal Users: (Create user for particular one database)
mysql> grant all privileges on .* to username@"localhost" identified by 'password';
Query OK, 0 rows affected (0.00 sec)
OR
CREATE USER 'nisnfs'@'localhost' IDENTIFIED BY 'password';
Give all database permission to particular user:
mysql> grant all privileges on *.* to nisnfs@"localhost" identified by 'nisnfs123';
Query OK, 0 rows affected (0.00 sec) [we can give this permission to already created users or while creating new users]

Example Of Creating One Database:

[root@sandeeplinux3 ~]# mysql -u root -p [login as root or normal user & give password]
Enter password:

mysql> create database sandeep_system_information; [Create database name on sandeep_system_information]

mysql> show databases; [Check created database]
+--------------------------------+
| Database |
+--------------------------------+
| sandeep_system_information |
| mysql |
| test |
+--------------------------------+
3 rows in set (0.00 sec)
mysql>

mysql> use sandeep_system_information; [Select created database]
Database changed

mysql> create table Hardware_Information (Processor char(50),Harddisk char(50),RAM char(25),Optical_Drive char(25),Screen char(25),Keyboard char(25),Mouse char(25),UPS char(25),Wireless_Adapter char(25));
Query OK, 0 rows affected (0.00 sec) [Create Table as Hardware_Information]

mysql> show tables; [Check created table]
+--------------------------------------------+
| Tables_in_sandeep_system_information |
+--------------------------------------------+
| Hardware_Information |
+--------------------------------------------+
1 row in set (0.00 sec)
mysql>crate table Hardware_Information (SL int(10),Name char(10),Remark char(10));
Query OK, 1 row affected (0.00 sec) [Create some coloms in table]
mysql>insert into Hardware_Information ('1','monitor','good'); [feel some value in rows by columns]
mysql> select * from Hardware_Information; [Show filled rows and columns]
mysql> exit [come out from sql server]
mysql> drop database sandeep_system_information; [Delete database name on sandeep_system_information]

Firewall With Mysql:
Edit iptables file for enable 3306 port
[root@sandeeplinux3 ~]# vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -s 192.168.1.0/24 -d 192.168.1.0/24 -p tcp --dport 3306 -j ACCEPT
-A RH-Firewall-1-INPUT -s 192.168.1.0/24 -d 192.168.1.0/24 -p udp --dport 3306 -j ACCEPT

Tuesday, March 16, 2010

Network Printer On Windows Machine


NETWOK PRINTER INSTALLATION ON WINDOWS

Requirement:
1. XP/2000/2003 Operating System (I have made XP machine as Network Printer)
2. Printer (I Configured On HP Officejet 5600 Series)
3. Printer Drivers (Need to Install On Connecting Printer Machine)
4. IP Address In same range (Connect All Machines & Printer In Same LAN with same IP range)

Note: All Setup should be happen in Administrator account only (Connected Printer machine & Client Machine also)
Printer Connected IP Address: 192.168.1.11

Steps:

1.Install Printer Drivers on Connected Printer Machine in administrator account
2.Connect 'n' no of system on same network (LAN)
3.Assign IP address and gateway in same range
4.Go to Start→control panel & click on Printer & Faxes (Connected Printer Machine)
5.Right click on Printer & Faxes → Share → Share this Printer → Apply → OK .
6.Go to client machine and check connectivity with Installed Printer system with ping 192.168.1.11.
7. Go to Run → \\192.168.1.11 ( Printer Installed IP Address) → Printer & Faxes → Open → right click on shared printer → connect. (In Client Machine)
8.Try to give test Print.
9.You will get print out by configured printer machine (192.168.1.11).

Note: In case in client machine limited users need to use network printer then once you have to follow same procedure what you have done in admin account (Run → \\192.168.1.11 ( Printer Installed IP Address) → Printer & Faxes → Open → right click on shared printer → connect).


Regards,
Sandeep CC

Monday, March 15, 2010

Configure Network Printer On REDHAT LINUX


LINUX LOCAL & NETWORK PRINTER INSTALLATION


Note: For Installing Linux Network Printer 1st we have to configure Samba & Need to create some user for accessing Printer from Other/windows machine, so 1st try to configure samba with users.

Server Name: Sandeeplinux Server (192.168.1.11)
Printer Name: Sandeep_Samba_Server (192.168.1.11)

Local Printer Installation On Linux Machine:

Note: Connect Printer to Linux Machine & Keep it On, and try to install printer connected linux system monitor.

Right Click On desktop → Open Terminal → [root@sandeeplinux ~]# system-config-printer → (One Window will open) Click On New → Forward → Give Printer Name (Sandeep_Samba_Printer) → Select a Queue Type Locally-Connected (/dev/lp0 Hewlett-Packard LaserJet 1200) → Forward → Select Priter Model (LaserJet 1200) → Finish → Test with test file.

Network Printer Installation With Windows LAN: (Sandeep_Samba_Printer)

Samba Server Printer Configuration: (Sandeep_Samba_Printer)

Edit: /etc/samba/smb.conf file and enter bellow things,

[root@sandeeplinux3 ~]# cd /etc/samba/
[root@sandeeplinux3 samba]# vi smb.conf

[global]
workgroup = WORKGROUP
security = user
printcap name = cups
disable spools = Yes
show add printer wizard = No
printing = cups

[printers]
comment = All Printers
path = /var/spool/samba
printer admin = user1, user2
create mask = 0770
guest ok = Yes
printable = Yes
use client driver = Yes
browseable = Yes

[root@sandeeplinux3 ~]# service smb restart
Shutting down SMB services: [ OK ]
Shutting down NMB services: [ OK ]
Starting SMB services: [ OK ]
Starting NMB services: [ OK ]
[root@sandeeplinux3 ~]# service cupsd restart (If require then only restart)

Client Windows With Printer Configuration: (Sandeep_Samba_Printer)

Win XP → Go to Start → Run → \\192.168.1.11 → Enter → Samba User Name (user1) → Samba User Password (user112345) → you will get one shared printer name as Sandeep_Samba_Printer → Right Click → Connect → Next → Yes → OK → OK → Select HP Printer from left hand side window → Select HP Printer Model No from Right hand side → Next → Finish.

Test With Network Printer and Windows file

Create one test file → Edit → Print → Select → \\192.168.1.11\Sandeep_Samba_Printer\ → Apply → Print → Check whether you are getting print by Sandeep_Samba_Server (Printer).


Thanks & Regards,
Sandeep CC

Thursday, March 11, 2010

NIS CONFIGURATION ON REDHAT LINUX


NIS SERVER CONFIGURATION (NETWORK INFORMATION SERVICE)

SERVER CONFIGURATION

Note: While NIS configuring time disable the firewall/iptables service (service iptables stop), later will configure firewall setting with NIS server.

Requirement:

1. Portmap (Default Installed)
2. Yp-tools (Default Installed)
3. Ypbind (Need To Install)
4. Ypserv (Need To Install)

Install Required Packages/tools:
[root@sandeep~]# rpm -i ypserv-2.13-5.x86_64.rpm (Install ypserv package)
[root@sandeep~]# rpm -i ypbind-1.17.2-3.x86_64.rpm (Install ypbind package)

Check Required Packages are Installed On NIS Server:
[root@sandeep ~]# rpm -qa portmap
portmap-4.0-63
[root@sandeep ~]# rpm -qa yp-tools
yp-tools-2.8-7
[root@sandeep ~]# rpm -qa ypbind
ypbind-1.17.2-3
[root@sandeep ~]# rpm -qa ypserv
ypserv-2.13-5
[root@sandeep ~]#

Edit Your /etc/sysconfig/network File
(You need to add the NIS domain you wish to use in the /etc/sysconfig/network file. For the SANDEEP, call the domain SANDEEP-NIS-SERVER.)

[root@sandeep ~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=sandeep
NISDOMAIN="SANDEEP-NIS-SERVER"

Edit Your /etc/yp.conf File
[root@sandeep ~]# vi /etc/yp.conf
# ypserver 192.168.1.11

Start the Key NIS server related daemons
Start the necessary NIS daemons in the /etc/init.d directory and use the chkconfig command to ensure they start after the next reboot
[root@sandeep]# service portmap start
Starting portmapper: [ OK ]
[root@sandeep]# service yppasswdd start
Starting YP passwd service: [ OK ]
[root@sandeep]# service ypserv start
Setting NIS domain name SANDEEP-NIS-SERVER: [ OK ]
Starting YP server services: [ OK ]
[root@sandeep]#

[root@sandeep]# chkconfig portmap on
[root@sandeep]# chkconfig yppasswdd on
[root@sandeep]# chkconfig ypserv on

[root@sandeep ~]# rpcinfo -p localhost
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 32769 status
100024 1 tcp 32769 status
100004 2 udp 862 ypserv
100004 1 udp 862 ypserv
100004 2 tcp 865 ypserv
100004 1 tcp 865 ypserv
600100069 1 udp 872 fypxfrd
600100069 1 tcp 874 fypxfrd
100009 1 udp 715 yppasswdd

Initialize Your NIS domain (Add Clients on NIS network)
[root@sandeep ~]# /usr/lib64/yp/ypinit -m

At this point, we have to construct a list of the hosts which will run NIS
servers. sandeep is in the list of NIS server hosts. Please continue to add
the names for the other hosts, one per line. When you are done with the
list, type a .
next host to add: sandeep
next host to add: sandeep1
next host to add: sandeep2
next host to add:

(Press Y and)

The current list of NIS servers looks like this:

sandeep
sandeep1
sandeep2


Is this correct? [y/n: y] y
We need a few minutes to build the databases...
Building /var/yp/SANDEEP-NIS-SERVER/ypservers...
gethostbyname(): Success
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/SANDEEP-NIS-SERVER'
Updating passwd.byname...
Updating passwd.byuid...
Updating group.byname...
Updating group.bygid...
Updating hosts.byname...
Updating hosts.byaddr...
Updating rpc.byname...
Updating rpc.bynumber...
Updating services.byname...
Updating services.byservicename...
Updating netid.byname...
Updating protocols.bynumber...
Updating protocols.byname...
Updating mail.aliases...
gmake[1]: Leaving directory `/var/yp/SANDEEP-NIS-SERVER'

sandeep has been set up as a NIS master server.

Now you can run ypinit -s sandeep on all slave server.
[root@sandeep ~]#

Start ypbind and ypxfrd Daemons:

[root@sandeep]# service ypbind start
Binding to the NIS domain: [ OK ]
Listening for an NIS domain server.
[root@sandeep]# service ypxfrd start
Starting YP map server: [ OK ]
[root@sandeep]# chkconfig ypbind on
[root@sandeep]# chkconfig ypxfrd on

Make sure daemons are running fine.
[root@sandeep ~]# rpcinfo -p localhost
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 32769 status
100024 1 tcp 32769 status
100004 2 udp 862 ypserv
100004 1 udp 862 ypserv
100004 2 tcp 865 ypserv
100004 1 tcp 865 ypserv
600100069 1 udp 872 fypxfrd
600100069 1 tcp 874 fypxfrd
100009 1 udp 715 yppasswdd
[root@sandeep ~]#

Adding New NIS Users
[root@sandeep]# useradd -g users nisuser
[root@sandeep]# passwd nisuser
Changing password for user nisuser.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@sandeep]# cd /var/yp
[root@sandeep yp]# make
gmake[1]: Entering directory `/var/yp/NIS-SCHOOL-NETWORK'
Updating passwd.byname...
Updating passwd.byuid...
Updating netid.byname...
gmake[1]: Leaving directory `/var/yp/NIS-SCHOOL-NETWORK'
[root@sandeep yp]#

You can check to see if the user's authentication information has been updated by using the ypmatch command, which should return the user's encrypted password string.
[root@sandeep yp]# ypmatch nisuser passwd
nisuser:$1$d6E2i79Q$wp3Eo0Qw9nFD/::504:100::/home/nisuser:/bin/bash
[root@sandeep yp]

You can also use the getent command, which has similar syntax. Unlike ypmatch, getent doesn't provide an encrypted password when run on an NIS server, it just provides the user's entry in the /etc/passwd file. On a NIS client, the results are identical with both showing the encrypted password.
[root@sandeep yp]# getent passwd nisuser
nisuser:x:504:100::/home/nisuser:/bin/bash
[root@sandeep yp]#

FIREWALL CONFIGURATION WITH NIS SERVER:

Edit /etc/sysconfig/iptables file for Enabling NIS (ypbind/portmap port – 111), Enable port no 111 for TCP as well as UDP. (Two lines given bellow just add in iptables file and save & exit)

[root@sandeep ~]# cd /etc/sysconfig/
[root@sandeep sysconfig]# vi iptables

-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 111 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 111 -j ACCEPT

:wq Enter (Save iptables file and exit)

Restart iptables service:
(Check service should not be [Fail],everything should be [OK])

[root@sandeep ~]# service iptables restart
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
Applying iptables firewall rules: [ OK ]
[root@sandeep ~]#

Restart ypbind service:
(Once restart ypbind service, check whether it will restart or not after enabling 111 port & starting firewall)

[root@sandeep ~]# service ypbind restart
Shutting down NIS services: [ OK ]
Binding to the NIS domain: [ OK ]
Listening for an NIS domain server.
[root@sandeep ~]#


CLIENT CONFIGURATION:

Note: While NIS Client configuring time disable the firewall/iptables service (service iptables stop), later will configure firewall setting with NIS server.

Run authconfig

The authconfig or the authconfig-tui program automatically configures your NIS files after prompting you for the IP address and domain of the NIS server
[root@sandeep2 ~]# authconfig-tui
Once finished, it should create an /etc/yp.conf file that defines, amongst other things, the IP address of the NIS server for a particular domain. It also edits the /etc/sysconfig/network file to define the NIS domain to which the NIS client belongs.

Requirement Of Package for Client Machine:
1. Portmap
2. Yp-tools
3. Ypbind

[root@sandeep2 etc]# vi yp.conf
domain SANDEEP-NIS-SERVER server 192.168.1.11
[root@sandeep2 etc]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=sandeep2
NISDOMAIN=SANDEEP-NIS-SERVER

[root@sandeep2 etc]# cat nsswitch.conf
passwd: files nis
shadow: files nis
group: files nis

Start The NIS Client Related Daemons
[root@sandeep2 etc]# service portmap start
Starting portmap: [ OK ]
[root@sandeep2 etc]# service ypbind start
Binding to the NIS domain: [ OK ]
Listening for an NIS domain server.
[root@sandeep2 etc]# chkconfig ypbind on
[root@sandeep2 etc]# chkconfig portmap on
[root@sandeep2 etc]#

Note:
Remember to use the rpcinfo -p localhost command to make sure they all started correctly.

[root@sandeep2 etc]# rpcinfo -p
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 32768 status
100024 1 tcp 32769 status
100011 1 udp 931 rquotad
100011 2 udp 931 rquotad
100011 1 tcp 934 rquotad
100011 2 tcp 934 rquotad
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100021 1 udp 32770 nlockmgr
100021 3 udp 32770 nlockmgr
100021 4 udp 32770 nlockmgr
100021 1 tcp 32803 nlockmgr
100021 3 tcp 32803 nlockmgr
100021 4 tcp 32803 nlockmgr
100005 1 udp 952 mountd
100005 1 tcp 955 mountd
100005 2 udp 952 mountd
100005 2 tcp 955 mountd
100005 3 udp 952 mountd
100005 3 tcp 955 mountd
100007 2 udp 1020 ypbind
100007 1 udp 1020 ypbind
100007 2 tcp 1023 ypbind
100007 1 tcp 1023 ypbind


Verify Name Resolution

As the configuration examples refer to the NIS client and server by their hostnames, you'll have to make sure the names resolve correctly to IP addresses. This can be configured either in DNS, when the hosts reside in the same domain, or more simply by editing the /etc/hosts file on both Linux boxes.

[root@sandeep2 etc]# vi hosts [Enter server IP and Machine Name]
# Do not remove the following line, or various programs
# that require network functionality will fail.
192.168.1.9 sandeep1 sandeep1
192.168.1.10 sandeep2 sandeep2 192.168.1.10
192.168.1.11 sandeep sandeep
127.0.0.1 localhost.localdomain localhost
[root@sandeep2 etc]#

Test NIS Access To The NIS Server
[root@sandeep2 etc]# ypcat passwd
nisuser:$1$6x8OLUK/$hzSCrGreGmaLie4.bJhmZ/:509:100::/home/nisuser:/bin/bash
sandeep:$1$uYwOkipg$h9lz.9mf896yKl.uDZeOy/:513:513::/home/sandeep:/bin/bash
ftp1:$1$b/0QI9C.$NgdU6DmNXN.X5r3vHIQhf0:510:515::/home/ftp1:/bin/bash
general:$1$wi.oLbwp$QRQaqFCWi8SRoxO674gyg/:511:511::/home/general:/bin/bash
tech:$1$xEBawVW.$LLATEJY0lOrWWbOpId3TL1:512:512::/home/tech:/bin/bash
[root@sandeep2 etc]#

[root@sandeep2 etc]# ypmatch nisuser passwd
nisuser:$1$6x8OLUK/$hzSCrGreGmaLie4.bJhmZ/:509:100::/home/nisuser:/bin/bash
[root@sandeep2 etc]#

[root@sandeep2 etc]# getent passwd nisuser
nisuser:$1$6x8OLUK/$hzSCrGreGmaLie4.bJhmZ/:509:100::/home/nisuser:/bin/bash
[root@sandeep2 etc]#

Test Logins via The NIS Server
Logging In Via SSH

Click On SSH Secure Shell → Quick Connect → Host Name (Give Client IP Address) 192.168.1.10 → User Name (Give Created nisuser in server) nisuser → Connect → Password (nisuser123) → you will get bash screen [Last login: Wed Feb 10 12:59:46 2010 from 192.168.1.212
-bash-3.00$
]

FIREWALL CONFIGURATION WITH NIS CLIENT:
Edit /etc/sysconfig/iptables file for Enabling NIS (ypbind/portmap port – 111), Enable port no 111 for TCP as well as UDP. (Two lines given bellow just add in iptables file and save & exit)

[root@sandeep2 ~]# cd /etc/sysconfig/
[root@sandeep2 sysconfig]# vi iptables

-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 111 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 111 -j ACCEPT

:wq Enter (Save iptables file and exit)

Restart iptables service:
(Check service should not be [Fail],everything should be [OK])

[root@sandeep2 ~]# service iptables restart
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
Applying iptables firewall rules: [ OK ]
[root@sandeep2 ~]#

Restart ypbind service:
(Once restart ypbind service, check whether it will restart or not after enabling 111 port & starting firewall)

[root@sandeep2 ~]# service ypbind restart
Shutting down NIS services: [ OK ]
Binding to the NIS domain: [ OK ]
Listening for an NIS domain server.
[root@sandeep2 ~]#

Troubleshoot with NIS server & Client:
Note: If firewall is running in Server then client ypbind will not start, so 1st take care of firewall, stop firewall and restart ypbind in server, then restart firewall & ypbind in client machine then restart firewall in server, then you wont get any kind of error. [if you have started firewall in server machine then trying to start ypbind with firewall in client side you wont get OK result, you will be get only Fail result after long time so keep in mind that 1st restart ypbind in server → restart firewall & ypbind in client machine → then restart firewall in server]

Wednesday, March 10, 2010

FTP Configuration On REDHAT LINUX-4


REDHAT LINUX-4 FTP CONFIGURATION:

RHEL server comes with vsftpd which is the Very Secure File
Transfer Protocol (FTP) daemon. The server can be launched
via a xinetd or as standalone mode, in which case vsftpd
itself will listen on the network port 21.

STEPS:

Install vsftpd rpm by CD driver (vsftpd application is available in redhat OS CD)
Install Vsftpd:
root ]# /media
media]# ls -l
media] cp vsftpd-2.0.1-5.EL4.3.x86_64.rpm /var/
media]# exit
root ]# cd /var/
var]# ls -ltr
var]# rpm -i vsftpd-2.0.1-5.EL4.3.x86_64.rpm (rpm -i vsftpd-2.0.1-5.EL4.3.x86_64.rpm –nodeps) [Or else we can also use yum to install instead of rpm)
root ]#

Turn on Vsftpd Service:
root ]# service vsftpd start (For Stop @ root ]# service vsftpd stop/status)

Open FTP Port
root ]# cd /etc/sysconfig/
root ]# ls -l
root ]# vi iptables
(Append following line to open ftp port 21 before REJECT line:)
Ports: 20 for data transmission & 21 for ftp controller

root ]# -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 20 -j ACCEPT
root ]# -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
root ]# (press Esc) :wq

Restart Iptables/Firewall
root ]# service iptables start

Test with FTP
root ]# ftp 192.168.1.25 (Try 1st test with same machine then go to other)

(The default configuration file is /etc/vsftpd/vsftpd.conf file. # vi /etc/vsftpd/vsftpd.conf)

Create the user.
useradd ftp1
passwd ftp1123

Edit FTP Conf file:-
root ]# vi /etc/vsftpd/vsftpd.conf
(Add this line at the end of the file)
userlist_deny=NO (This option use for ftp users, if you give NO then you have to add, needed users in /etc/vsftd.user_list or else if you give YES then all user have ftp permissions means any normal users can access ftp server)

Edit user_list file,
root ]# vi /etc/vsftpd.user_list
ftp1
(And add the above created users in this file to access FTP server)

Restart FTP services
/etc/init.d/vsftpd start/restart
chkconfig vsftpd on ( for permanent on )

* Create some user and password.
* Then Try with Windows system.

To Disable Root Directory

[root@server vsftpd]# vi vsftpd.conf
chroot_list_enable=YES ----> Remove #
chroot_list_file=/etc/vsftpd/chroot_list ----> Remove # & Give path of chroot_list file
[Create one file in /etc/vsftpd/chroot_list & Put users name, which users needed access of ftp]

Note:
We can transfer the data from Linux to Windows by using FTP (by using win XP machine), If we require to transfer data from Window to Linux (by using Linux machine) then we have to enable FTP port (21) in windows machine.

Tuesday, March 9, 2010

Linux Basic & Networking Commands

Hi Friends Check Basic & Networking Linux Commands,

USFULL COMMANDS:

1. history|head -n 100 [ For no of showing commands]
2. history [ History commands ]
3. mail [ Check mails ]
4. hostname [ Check hostname ]
5. ifconfig [ Check network configuration ] {In Root Previlage}
6. setup [ Setting network (IP) ]
7. service start/stop/restart/status [Strat/stop/restart the services]
8. ping [ Check network connection between 2 computers ]
9. iptables [ Regarding firewall ]
10. init 0 [ Shutdown ]
11. init 6 [ Restart ]
12. useradd < name > [ Create user account ]
13. passwd < user name > [ Set password for user ]
14. chkconfig [ updates and queries runlevel information for system services ]
15. chkconfig service_name on [ keep service continuesly on ]
16. cd < directory name > [ Change directory ]
17. ls -l [ list directory contents ]
18. cat < File name > [ Show file contents ]
19. mkdir < directory name > [ Create directory ]
20. touch < file name > [ Create file ]
21. vi < file name > [ Edit the file ]
22. rm < file name > [ Remove the file ]
23. clear [ Clean/Clear the desktop/shell ]
24. more < about name > [ Viewing more thing about that ]
25. man [ Meaning of the Concept ]
26. logout [ Logout from user account ]
27. shutdown [ Shutdown system ]
28. login [ Loging as user ]
29. cd .. [ Go to one step back (back directory) ]
30. su -l < user name > [ Switch user with password]
31. pwd [ Shows present working directoy ]
32. cp < Source file name > [ Copy the file ]
33. mv < Source file name > [ Move the files or directory ]
34. df [ Disk space ]
35. hostname [ Check system name ]
36. last [ Show listing of last logged in users ]
37. less [ Check for last some sentence of the file ]
38. crontab -eu < user name >[ Scheduling the job ]
39. date < dd/mm/yy > [ Check date ]
40. exit [ Exit from contents ]
41. whereis [ Locate the binary, source, and manual page files for a command ]
42. who [ Show who is logged on ]
43. echo [ display a line of text ]
44. which [ shows the full path of (shell) commands ]
45. dig [ DNS lookup utility ]
46. bc [ Calculator ]
47. mesg n [ control write access to your terminal ]
48. diff [ Difference between 2 files ]
49. grep < cat /etc/services|grep i ftp > [ Check for word ]
50. ps [ Check system proccess ]
51. du < file name > [ Check file uses space ]
52. chown [ Change file owner and group ]
53. chmod < -R > < u+rwx,g+rwx,o+rwx > < file name > [ Set the permission for file ]
(drw-r----- [file/directory permissions has show on)
(l --> Link, d --> Directory, p --> Pipe, c --> character device, b --> Block device)
(Permissions in NO's Read=4, Write=2, Executable=1)
54. tail < file name > [ It will show files last ten sentence ]
55. printenv < file name > [ print all or part of environment ]
56. tty [ Check for which terminal connected to which user ]
57. stty [ Change and print terminal line settings ]
58. rmdir < Directory name > [ Remove the directory ]
59. top [ Check system Process ]
60. mount < file name > [ Mount the file, file system ]
61. cal [ Display the calender ]
62. wc < file name > [ Word, Line, Carrector will count ]
63. route [ Show/manipulate the IP routing table ]
64. users [ It will show current user path ]
65. printf [ format and print data ]
66. uname [ Check OS version ]
67. cmp < file name 1 > < file name 2 > [ compare two files]
68. comm < file name 1 > < file name 2 > [ compare two sorted files line by line ]
69. netconfig < at root user only > [ Setup network configuration ]
70. alias < c=clear >[ Setup alias ]
71. vi /root/.bashrc [ This is for perment setting alias ] {In root previlage}
72. tar -cvf < file name.tar > [ Backup ]
73. fdisk -l [ Check for partitions ]
74. history -c [Clear full history commands]
75. startx [GUI mode]
76. init tab [Set the Run Level for GUI-5 & for Command Mode-3]
77. useradd -g [Add User to Group]
78. groupadd [create group]
79. groupmod [change group name]
80. rm -rf [Delete user home directory from /home directory]
81. userdel -r [this cmd will delete user with user's home directory from /home]
82. rm -rf [removing main directory with sub directory at a time]
83. smbpasswd [Create Samba user, normal user should be create before sbm user]
84. smbpasswd -x [Delete only Smb user]
85. df -h [check partitions, mounted partitions]
86. cat /etc/passwd | mksmbpasswd.sh > /etc/samba/smbpasswd (Recover /etc/samba smbpasswd file)
86. vi /root/.bashrc (setup for perment alias)
87. crontab -e 15 15 * * * /sbin/shutdown -h now [Setup cronjob for shutdown]
88. crontab -e 12 12 * * * /sbin/shutdown -r now [Setup cronjob for reboot]
89. # /etc/init.d/iptables start/restart/stop/status [Start the iptables file /etc/sysconfig/iptables]
90. rpm -i [Install rpm package]
91. [find Installed rpm package]
92. rpm -e |grep [Uninstall rpm package]
93. ls -ltr -filename* [find files in directory]
94. ps -aef [Check all running process ID's]
95. ps -aef |grep [Check Particular Process ID]
96. find |grep [Find word in file]
97. Command | grep [find word in command exp: ifconfig want to find 00:19:D1:13:A6:EE MAC then we can use]
98. cat \etc\service [All Port No, available]
99. system-config-network
100. du -hs [Check directory/folder size]
101. netstat -l [less will show currently listening servers]
102. mount 192.168.1.11:/home/sandeep/[server share directory] /home/sandeep/[client directory] [NFS share/mount directorys]
103. umount 192.168.1.11:/home/sandeep/[server share directory] /home/sandeep/[client directory] [NFS share/unmount directorys]
104. uname -a [Check Linux Machine name as well as OS version 32/64 bit]
105 rpcinfo -p [check running port No]
106 cat /var/lib/dhcpd/dhcpd.leases [Check connected clients to DHCP server]
107. service --status-all [Check all Running services]
108. free [Check RAM Size : free -k/m/g]
109. cat /proc/meminfo [Check Memory Size]
110. cat /proc/cpuinfo [Check Processor Details]
111. /usr/share/squid/errors/English [Modify all Squid Error/Warning notice]
112. ssh -l [Access remotely computer via command mode]
113. locate [Find File in whole system]
114. setenforce 0 [Disabling SELinux]
115. setenforce 1 [Enabling SELinux]
116. testparm -s [Check Error with Samba Server]
117. netstat -a [Check server/service Process running or not Ex: netstat -a | grep ftp]
118. rpm -ivh httpd-2.2.3-22.el5.i386.rpm apr-1.2.7-11.i386.rpm apr-util-1.2.7-7.el5.i386.rpm postgresql-libs-8.1.11-1.el5_1.1.i386.rpm [HTTPD CONFIGURATION]


119. Killing Particular session TTY
ps -ft [Session ID/No] Exp ps -ft pts/1
kill -9 PID of session

120. htpasswd /etc/squid/squid_password sandeep [add HTTP user/password for squid]

121. mount -o remount,rw /etc [In single user mode edit FSTAB file with write permission]

122. parted [It will view all primary and extended-logical drives] Next give print command to view..

123. getenforce [check selinux disable or enabled

124. iptables -L

125. cat /var/log/messages | grep DHCPACK [Check all Client connected DHCP server]

126. scp vnc-4_1_3-x86_linux.rpm root@172.16.4.205:/tmp/ [Copy to Remote System]

127. HISTTIMEFORMAT="%d/%m/%y %T " [Check History with time and date]
Thanks and Regards,
Sandeep CC