Slide

  • LINUX

    LINUX:In 1969 AT&T made a decision to withdraw Multics and go with GECOS (General Electric Comprehensive Operating Supervisor / System), with AT & T in Bells Lab when Multics was withdrawn some of the programmers named Ken Thompson and Dennis Ritchie decided to rewrite operating system in order to support low cost computer..To Know More

    CLICK HERE

  • MICROSOFT

    MICROSOFT:Microsoft was established to develop and sell BASIC interpreters for the Altair 8800. It rose to dominate the home computer operating system market with MS-DOS in the mid-1980s,followed by the Microsoft Windows line of operating systems. To Know More

    CLICK HERE

  • CISCO

    CISCO:During the early 1980s, there was a married couple namely Len and Sandy Bosack who used to work in two different departments of computer located in Stanford University. This couple was facing problem in making their computers communicate with each other To Know More

    CLICK HERE

showinfo=1

MySQL (Master-Slave) Replication

The MySQL Replication is very useful in terms of Data SecurityFail-over SolutionDatabase Backup from SlaveAnalytics etc. We use the following things to carry the replication process. In your scenario it would be different.
  1. Working Linux OS like CentOS 6.3RedHat 6.3 or Fedora 17
  2. Master and Slave are CentOS 6.3 Linux Servers.
  3. Master IP Address is: 192.168.1.1.
  4. Slave IP Address is: 192.168.1.2.
  5. Master and Slave are on the same LAN network.
  6. Master and Slave has MySQL version installed.
  7. Master allow remote MySQL connections on port 3306.
We have two servers, one is Master with IP (192.168.1.1) and other is Slave as (192.168.1.2). We have divided the setup process in two phases to make things easier for you, In Phase I we will configure Master server and in Phase II with Slave server. Let’s start the replication setup process.

Phase I: Configure Master Server (192.168.1.1) for Replication

In Phase I, we will see the installation of MySQL, setting up Replication and then verifying replication.
Install a MySQL in Master Server
First, proceed with MySQL installation using YUM command. If you already have MySQL installation, you can skip this step.

   # yum install mysql-server mysql
Configure a MySQL in Master Server
Open my.cnf configuration file with VI editor.
# vi /etc/my.cnf
Add the following entries under [mysqld] section and don’t forget to replace cms with database name that you would like to replicate on Slave.
server-id = 1
binlog-do-db=cms
relay-log = /var/lib/mysql/mysql-relay-bin
relay-log-index = /var/lib/mysql/mysql-relay-bin.index
log-error = /var/lib/mysql/mysql.err
master-info-file = /var/lib/mysql/mysql-master.info
relay-log-info-file = /var/lib/mysql/mysql-relay-log.info
log-bin = /var/lib/mysql/mysql-bin
Restart the MySQL service.
# /etc/init.d/mysqld restart
Login into MySQL as root user and create the slave user and grant privileges for replication. Replace slave_user with user and your_password with password.
# mysql -u root -p

mysql> GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY 'your_password';
mysql> FLUSH PRIVILEGES;
mysql> FLUSH TABLES WITH READ LOCK;
mysql> SHOW MASTER STATUS;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000003 | 11128001 | cms          |                  |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
mysql> quit;
Please write down the File (mysql-bin.000003) and Position (11128001) numbers, we required these numbers later on Slave server. Next apply READ LOCK to databases to export all the database and master database information with mysqldump command.
#  mysqldump -u root -p --all-databases --master-data > /root/dbdump.db
Once you’ve dump all the databases, now again connect to mysql as root user and unlcok tables.
mysql> UNLOCK TABLES;
mysql> quit;
Upload the database dump file on Slave Server (192.168.1.2) using SCP command.
scp /root/dbdump.db root@192.168.1.2:/root/
That’s it we have successfully configured Master server, let’s proceed to Phase II section.

Phase II: Configure Slave Server (192.168.1.2) for Replication

In Phase II, we do the installation of MySQL, setting up Replication and then verifying replication.
Install a MySQL in Slave Server
If you don’t have MySQL installed, then install it using YUM command.
# yum install mysql-server mysql
Configure a MySQL in Slave Server
Open my.cnf configuration file with VI editor.
# vi /etc/my.cnf
Add the following entries under [mysqld] section and don’t forget to replace IP address of Master server, cms with database name etc, that you would like to replicate with Master.
server-id = 2
master-host=192.168.1.1
master-connect-retry=60
master-user=slave_user
master-password=yourpassword
replicate-do-db=cms
relay-log = /var/lib/mysql/mysql-relay-bin
relay-log-index = /var/lib/mysql/mysql-relay-bin.index
log-error = /var/lib/mysql/mysql.err
master-info-file = /var/lib/mysql/mysql-master.info
relay-log-info-file = /var/lib/mysql/mysql-relay-log.info
log-bin = /var/lib/mysql/mysql-bin
Now import the dump file that we exported in earlier command and restart the MySQL service.

# mysql -u root -p
mysql> slave stop;

# mysql -u root -p < /root/dbdump.db
# /etc/init.d/mysqld restart
Login into MySQL as root user and stop the slave. Then tell the slave to where to look for Master log file, that we have write down on master with SHOW MASTER STATUS; command as File (mysql-bin.000003) and Position (11128001) numbers. You must change 192.168.1.1 to the IP address of the Master Server, and change the user and password accordingly.

# mysql -u root -p
mysql> slave stop;
mysql> CHANGE MASTER TO MASTER_HOST='192.168.1.1', MASTER_USER='slave_user', MASTER_PASSWORD='yourpassword', MASTER_LOG_FILE='mysql-bin.000003', MASTER_LOG_POS=11128001;
mysql> slave start;
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.1.1
Master_User: slave_user
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 12345100
Relay_Log_File: mysql-relay-bin.000002
Relay_Log_Pos: 11381900
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: cms
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 12345100
Relay_Log_Space: 11382055
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
1 row in set (0.00 sec)

Verifying MySQL Replication on Master and Slave Server

It’s really very important to know that the replication is working perfectly. On Master server create table and insert some values in it.
On Master Server
mysql> use cms;
mysql> CREATE TABLE employee (c int);
mysql> INSERT INTO employee (c) VALUES (1);
mysql> SELECT * FROM employee;
+------+
|  c  |
+------+
|  1  |
+------+
1 row in set (0.00 sec)
On Slave Server
Verifying the SLAVE, by running the same command, it will return the same values in the slave too.
mysql> use cms;
mysql> SELECT * FROM employee;
+------+
|  c  |
+------+
|  1  |
+------+
1 row in set (0.00 sec)
That’s it, finally you’ve configured MySQL Replication in a few simple steps.


Disk Quota


Disk Quota


Disk Quotas are used to limit a user's or a group of users' ability to consume disk space. This prevents a small group of users from monopolizing disk capacity and potentially interfering with other users or the entire system.Disk quotas are commonly used by ISPs, by Web hosting companies, on FTP sites, and on corporate file servers to ensure continued availability of their systems. Using disk quota administrator can restrict user in two ways :-

1. Restricting user or group by creating files in a specific location.
2. Restricting user or group by the disk space in a specific location.

Disk Quota Terms

1. Soft Link = Disk space a user can use
2. Hard Link = Absolute limit a user can use
3. Grace Periods = Time duration till user can use hard limit space
4. 1 inode = 1KB
5. dd = used to create a blank file of specific size
6. required RPM = quata-*
7. /etc/fstab option = userquota, grpquota
8. Quota files = aquota.user. aquota.group
9. Necessary Commands = mount, quotarun, quotacheck, edquota, quotaoff, quotaon

1. To set quota on user.

[root@server1 ~]#useradd usr1
[root@server1~]# passwd usr1
Changing password for user username.
New password: * * * * *
BAD PASSWORD: it is based on a directory word
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication token updated successfully.

[root@server1 ~]#vi /etc/fstab
UUID=2f3r7yf8-bd9h-56tf-h8gt-45df12g74fdv  /home  ext4  defaults,usrquota  1 2

:wq!


[root@server1 ~]#mount
/dev/sda5 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
/dev/sda1 on /boot type ext4 (rw)
/dev/sda7on /home type ext4 (rw)
/dev/sda8 on /tmp type ext4 (rw)
/dev/sda2 on /usr type ext4 (rw)
/dev/sda3 on /var type ext4 (rw)
/dev/sda9 on /example type ext4 (rw)

[root@server1 ~]#mount -o remount /home
[root@server1 ~]#mount
dev/sda5 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
/dev/sda1 on /boot type ext4 (rw)
/dev/sda7on /home type ext4 (rw,usrquota)
/dev/sda8 on /tmp type ext4 (rw)
/dev/sda2 on /usr type ext4 (rw)
/dev/sda3 on /var type ext4 (rw)
/dev/sda9 on /example type ext4 (rw)
[root@server1 ~]#touch /home/aquota.user
[root@server1 ~]#quotacheck -vc /home
[root@server1 ~]#repquota -a

Block Limits File Limits
User used soft hard grace used soft hard grace
root -- 24    0      0      3        0     0      0
cms -- 36    0      0      9         0     0      0
usr1 -- 32   0      0      8         0     0       0 
usr2 -- 32   0      0      8         0     0       0
usr3 -- 32   0      0      8         0     0       0

[root@server1 ~]#quotacheck -vc /home
[root@server1 ~]#quotaon -v /home
[root@server1 ~]#setquota –u usr1 256 512 0 0 /home
Username Mini Maxi Mini Maxi Mount Point
Block Block File File to set Quota
Limit Limit Limit Limit
[root@server1 ~]#repquota -a

Block Limits File Limits
User used soft hard grace used soft hard grace
root -- 24    0      0      3        0     0      0
cms -- 36    0      0      9         0     0      0
usr1 -- 32 256   512   8         0     0       0
usr2 -- 32   0      0      8         0     0       0
usr3 -- 32   0      0      8         0     0       0

[root@server1 ~]#

Now login with that user3 from another console.
CTRL+ALT+F2
Server1 Login : usr1
Password: ******  


[use3@server1 ~]$dd if=/dev/zero of=file1 bs=1K count=100
100+0 records in
100+0 records out
102400 bytes (102 kB) copied, 0.000875702 s, 117 MB/s

[use3@server1 ~]$ll
-rw-rw-r--. 1 usr1 usr1 102400 Jun 20 07:05 file1
[use3@server1 ~]$dd if=/dev/zero of=file1 bs=1K count=300
300+0 records in
300+0 records out
307200 bytes (307 kB) copied, 0.0142128 s, 21.6 MB/s

[use3@server1 ~]$ll
-rw-rw-r--. 1 usr1 usr1 307200 Jun 20 07:05 file1
[use3@server1 ~]$dd if=/dev/zero of=file1 bs=1K count=500
Dd: writing ‘file1’ : Disk quota exceeded
477+0 records in
476+0 records out
487424 bytes (487 kB) copied, 0.0057277 s, 85.1 MB/s

[use3@server1 ~]$ll
-rw-rw-r--. 1 usr1 usr1 487424 Jun 20 07:05 file1
[use3@server1 ~]$

CTRL+D ……..to log out from usr1

Server1 Login :root
Password: ******  


[root@server1 ~]#repquota -a
Block Limits File Limits
User used soft hard grace used soft hard grace
root -- 24    0      0      3        0     0      0
cms -- 36    0      0      9         0     0      0
usr1 -- 32 256   512 6days    0     0       0
usr2 -- 32   0      0      8         0     0       0
usr3 -- 32   0      0      8         0     0       0

2. To set same quota limit on multiple user.

[root@server1 ~]#useradd usr2
[root@server1~]# passwd usr2
Changing password for user username.
New password: * * * * *
BAD PASSWORD: it is based on a directory word
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication token updated successfully.

 [root@server1 ~]#useradd usr3
[root@server1~]# passwd usr3
Changing password for user username.
New password: * * * * *
BAD PASSWORD: it is based on a directory word
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication token updated successfully.

[root@server1 ~]#vi /etc/fstab
UUID=2f3r7yf8-bd9h-56tf-h8gt-45df12g74fdv /home ext4 defaults,usrquota 1 2

:wq!


[root@server1 ~]#mount
/dev/sda5 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
/dev/sda1 on /boot type ext4 (rw)
/dev/sda7on /home type ext4 (rw)
/dev/sda8 on /tmp type ext4 (rw)
/dev/sda2 on /usr type ext4 (rw)
/dev/sda3 on /var type ext4 (rw)
/dev/sda9 on /example type ext4 (rw)

[root@server1 ~]#mount -o remount /home
[root@server1 ~]#mount
dev/sda5 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
/dev/sda1 on /boot type ext4 (rw)
/dev/sda7on /home type ext4 (rw,usrquota)
/dev/sda8 on /tmp type ext4 (rw)
/dev/sda2 on /usr type ext4 (rw)
/dev/sda3 on /var type ext4 (rw)
/dev/sda9 on /example type ext4 (rw)
[root@server1 ~]#touch /home/aquota.user
[root@server1 ~]#quotacheck -vc home
[root@server1 ~]#repquota -a

Block Limits File Limits
User used soft hard grace used soft hard grace
root -- 24    0      0      3        0     0      0
cms -- 36    0      0      9         0     0      0
usr1 -- 32   0      0      8         0     0       0 
usr2 -- 32   0      0      8         0     0       0
usr3 -- 32   0      0      8         0     0       0

[root@server1 ~]#quotacheck -vc /home
[root@server1 ~]#quotaon -v /home
/dev/sda7 [/home]: user quotas turned on
[root@server1 ~]#setquota –u usr2 256 512 0 0 /home

Username Mini Maxi Mini Maxi Mount Point
Block Block File File to set Quota
Limit Limit Limit Limit

[root@server1 ~]#edquota –p usr2 usr3

Username another
to whome userto
quota is set same
set quota as user2

[root@server1 ~]#repquota -a

Block Limits File Limits
User used soft hard grace used soft hard grace
root -- 24    0      0      3        0     0      0
cms -- 36    0      0      9         0     0      0
usr1 -- 32   0      0      8         0     0       0 
usr2 -- 32   256  512  8         0     0       0
usr3 -- 32   256  512   8         0     0       0

[root@server1 ~]#

Now login with that usr2 from another console.
CTRL+ALT+F2
Server1 Login : usr2
Password: ******
[usr2@server1 ~]$dd if=/dev/zero of=file1 bs=1K count=100
100+0 records in
100+0 records out
102400 bytes (102 kB) copied, 0.000875702 s, 117 MB/s


[usr2@server1 ~]$ll
-rw-rw-r--. 1 usr2 usr2 102400 Jun 20 07:05 file1
[usr2@server1 ~]$dd if=/dev/zero of=file1 bs=1K count=300
300+0 records in
300+0 records out
307200 bytes (307 kB) copied, 0.0142128 s, 21.6 MB/s

[usr2@server1 ~]$ll
-rw-rw-r--. 1 usr2 usr2 307200 Jun 20 07:05 file1
[usr2@server1 ~]$dd if=/dev/zero of=file1 bs=1K count=500 ………
Dd: writing ‘file1’ : Disk quota exceeded
477+0 records in
476+0 records out
487424 bytes (487 kB) copied, 0.0057277 s, 85.1 MB/s


[usr2@server1 ~]$ll
-rw-rw-r--. 1 usr2 usr2 487424 Jun 20 07:05 file1

[use2@server1 ~]$

CTRL+D ……..to log out from usr2

Now login with that usr3.
Server1 Login : usr3
Password: ******  


[usr3@server1 ~]$dd if=/dev/zero of=file1 bs=1K count=100
100+0 records in
100+0 records out
102400 bytes (102 kB) copied, 0.000875702 s, 117 MB/s

[usr3@server1 ~]$ll
-rw-rw-r--. 1 usr3 usr3 102400 Jun 20 07:05 file1
[use3@server1 ~]$dd if=/dev/zero of=file1 bs=1K count=300
300+0 records in
300+0 records out
307200 bytes (307 kB) copied, 0.0142128 s, 21.6 MB/s

[usr3@server1 ~]$ll
-rw-rw-r--. 1 usr3 usr3 307200 Jun 20 07:05 file1
[usr3@server1 ~]$dd if=/dev/zero of=file1 bs=1K count=500
Dd: writing ‘file1’ : Disk quota exceeded
477+0 records in
476+0 records out
487424 bytes (487 kB) copied, 0.0057277 s, 85.1 MB/s

[usr3@server1 ~]$ll
-rw-rw-r--. 1 usr3 usr3 487424 Jun 20 07:05 file1
[usr3@server1 ~]$

CTRL+D ……..to log out from usr3

Now login with root.
Server1 Login : root
Password: ******
[root@server1 ~]#repquota -a
Block Limits File Limits
User used soft hard grace used soft hard grace
root -- 24    0      0      3        0     0      0
cms -- 36    0      0      9         0     0      0
usr1 -- 32   0      0      8         0     0       0 
usr2 -- 32   256  512  6days  0     0       0
usr3 -- 32   256  512  6days  0     0       0




SAMBA Server And Client Config


SAMBA Server And Client Config


Samba is a software package that comes with RHEL 6.0 that lets you share file systems and printers on a network with computers that use the Session Message Block (SMB) protocol. SMB is the protocol that is delivered with Windows operating systems for sharing files and printers
You can do four basic things with Samba:
Share a Linux directory tree with Windows and Linux/Unix computers
Share a Windows directory with Linux/Unix computer0073
Share a Linux printer with Windows and Linux/Unix computers
Share a Windows printer with Linux/Unix computers

Configurations Files

1. /etc/samba/smb.conf- Main Configuration File

1. Configurations Samba Server.



[root@server1 ~]# yum install samba*
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Package samba-common-3.5.4-68.el6.i686 already installed and latest version
Package samba-winbind-clients-3.5.4-68.el6.i686 already installed and latest version
Package samba-client-3.5.4-68.el6.i686 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package samba.i686 0:3.5.4-68.el6 set to be updated
---> Package samba-winbind.i686 0:3.5.4-68.el6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================
Package Arch Version Repository Size
===========================================================================
Installing:
samba i686 3.5.4-68.el6 Server 5.0 M
samba-winbind i686 3.5.4-68.el6 Server 3.5 M

Transaction Summary
===========================================================================
Install 2 Package(s)
Upgrade 0 Package(s)

Total download size: 8.5 M
Installed size: 30 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): samba-3.5.4-68.el6.i686.rpm | 5.0 MB 00:00
(2/2): samba-winbind-3.5.4-68.el6.i686.rpm | 3.5 MB 00:00
--------------------------------------------------------------------------------
Total 6.4 MB/s | 8.5 MB 00:01
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : samba-winbind-3.5.4-68.el6.i686 1/2
Installing : samba-3.5.4-68.el6.i686 2/2

Installed:
samba.i686 0:3.5.4-68.el6 samba-winbind.i686 0:3.5.4-68.el6
Complete!
[root@server1 ~]#vi /etc/samba/smb.conf
:se nu
Line No. 74
workgroup = MYGROUP

change this line as follow
workgroup = workgroup

Line No. 289
Add this lines
[Kavi]
comment = sam ram
path = /kavi
public = yes
writable = yes
printable =no


:wq!
[root@server1 ~]# useradd u1
[root@server1 ~]# passwd u1
Changing password for user u1.
New password: * * * * * (u1)
BAD PASSWORD: it is WAY too short
BAD PASSWORD: is too simple
Retype new password: * * * * *(u1)
passwd: all authentication tokens updated successfully.


Adding normal user has samba user.
[root@server1 ~]# smbpasswd  -a u1
New SMB password:* * * * * (u1@123)
Retype new SMB password:* * * * *(u1@123)
Added user u1.

enabling u1 user has samba user.
[root@server1 ~]# smbpasswd  -e u1
[root@server1 ~]# servicesmb restart
Shutting down SMB services: [ FAILED ]
Starting SMB services: [ OK ]
[root@server1 ~]#chkconfig--level 35 smb on

1.Configurations Samba Client (on windows).
Go to Start-Run-\\200.0.0.1\
type username and password
username - u1
password - *****(u1@123)

Now your are able to access kavi directory and files from it & user u1 home directory as well.

2. Configurations Samba Server without sharing samba user’s home directory.
To hide home directory of Samba User
[root@server1 ~]#vi /etc/samba/smb.conf
:se nu

Line No . 248
[homes]
comment = Home Directories
browesable = no
; valid users = %S
; valid users = MYDOMAIN\%S

Modify this line as follow
;[homes]
; comment = Home Directories
; browesable = no
; valid users = %S
; valid users = MYDOMAIN\%S


:wq!
[root@server1 ~]# servicesmb restart
Shutting down SMB services: [ OK ]
Starting SMB services: [ OK ]

2.Configurations Samba Client (on windows).



Go to Start-Run-\\200.0.0.1\
type username and password
username - u1
password - *****

Now your are able to see user’s home directory of user u1.

NFS (Network File System)


NFS (Network File System)


A Network File System (NFS) allows remote hosts to mount file systems over a network and interact with those file systems as though they are mounted locally. This enables system administrators to consolidate resources onto centralized servers on the network. The Network File System (NFS) is the standard for sharing files on a directory with Linux and Unix computers. It was originally developed by Sun Microsystems in the mid-1980s.
You can create shared NFS directories directly by editing the /etc/exports configuration file, or you can create them with Red Hat's NFS Configuration tool.

Configurations Files


1. /etc/exports - Main Configuration File

1. Configurations NFS Server.

[root@server1 ~]# yum install nfs*
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package nfs-utils.i686 1:1.2.2-7.el6 set to be updated
---> Package nfs-utils-lib.i686 0:1.1.5-1.el6 set to be updated
---> Package nfs4-acl-tools.i686 0:0.3.3-5.el6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================== Package Arch Version Repository Size
===========================================================================
Installing:
nfs-utils i686 1:1.2.2-7.el6 Server 296 k
nfs-utils-lib i686 1.1.5-1.el6 Server 65 k
nfs4-acl-tools i686 0.3.3-5.el6 Server 43 k

Transaction Summary
===========================================================================
Install 3 Package(s)
Upgrade 0 Package(s)

Total download size: 404 k
Installed size: 989 k
Is this ok [y/N]: y
Downloading Packages:
(1/3): nfs-utils-1.2.2-7.el6.i686.rpm | 296 kB 00:00
(2/3): nfs-utils-lib-1.1.5-1.el6.i686.rpm | 65 kB 00:00
(3/3): nfs4-acl-tools-0.3.3-5.el6.i686.rpm | 43 kB 00:00
-----------------------------------------------------------------------------------------------------------------------------
Total 2.5 MB/s | 404 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 1:nfs-utils-1.2.2-7.el6.i686 1/3
Installing : nfs-utils-lib-1.1.5-1.el6.i686 2/3
Installing : nfs4-acl-tools-0.3.3-5.el6.i686 3/3

Installed:
nfs-utils.i686 1:1.2.2-7.el6 nfs-utils-lib.i686 0:1.1.5-1.el6 nfs4-acl-tools.i686 0:0.3.3-5.el6
Complete!

[root@server1 ~]# mkdir  /data
[root@server1 ~]# cd  /data
[root@server1 data]# ll
total 0
[root@server1 data]# touch file1 file2
[root@server1 data]# cat >> file1
Welcome
CTRL+D  


[root@server1 data]# ll
total 0
-rw-r--r-- 1 root root 8 Aug 8 13:26 file1
-rw-r--r-- 1 root root 0 Aug 8 13:26 file2
[root@server1 data]# chmod o+rw file1
[root@server1 data]# ll
total 4
-rw-r--rw- 1 root root 8 Aug 8 13:29 file1
-rw-r--r-- 1 root root 0 Aug 8 13:26 file2
[root@server1 ~]# vi /etc/exports

i and add following line in it to access data directory by everyone in the network

/data *(rw,sync)


:wq!  


[root@server1 ~]# service nfs restart
Shutting down NFS mountd: [FAILED]
Shutting down NFS daemon: [FAILED]
Shutting down NFS quotas: [FAILED]
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
Starting RPC idmapd: [ OK ]
[root@server1 ~]# chkconfig --level 35 nfs on
[root@server1 ~]# showmount -e 200.0.0.1
Export list for 200.0.0.1:
/data *

1. Configurations NFS Client.
[root@client ~]# showmount –e 200.0.0.1
Export list for 200.0.0.1:
/data *
[root@client ~]# mount 200.0.0.1:/data /mnt
[root@client ~]# cd /mnt
[root@client mnt]# ll
total 0
-rw-r--r-- 1 root root 0 Aug 8 13:26 file1
-rw-r--r-- 1 root root 0 Aug 8 13:26 file2
[root@client mnt]# cat >> file1
bash: file1: Permission denied
[root@client mnt]# ll
total 4
-rw-r--rw- 1 root root 8 Aug 8 13:29 file1
-rw-r--r-- 1 root root 0 Aug 8 13:26 file2
[root@client mnt]# cat >> file1
welcome
to  ITTables
CTRL+D
[root@clientmnt]# cat file1
welcome
to ITTables
[root@clientmnt]# vi file1
i
welocme to ITTables


:wq!
[root@client mnt]# cat file1
welcome to ITTables




2. Configurations NFS Server to share directory for specific client .





[root@server1 ~]# vi /etc/exports

i and add following line in it to access data directory only by specific ip address in the network i.e. 200.0.0.40

/data 200.0.0.40(rw,sync)


:wq! …….
[root@server1 ~]# service nfs restart
Shutting down NFS mountd: [ OK ]
Shutting down NFS daemon: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [ OK ]
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
[root@server1 ~]# showmount -e 200.0.0.1
Export list for 200.0.0.1:
/data 200.0.0.40

2. Configurations NFS Client.


[root@client2 ~]# showmount -e 200.0.0.1
Export list for 200.0.0.1:
/data 200.0.0.40
[root@client2 ~]# mount 200.0.0.1:/data /mnt
[root@client2 ~]# cd /mnt
[root@client2 mnt]# ll
total 0
-rw-r--r-- 1 root root 0 Aug 8 13:26 file1
-rw-r--r-- 1 root root 0 Aug 8 13:26 file2

[root@client1 ~]# mount 200.0.0.1:/data /mnt
cannot open directory .: Permission denied



3. Configurations NFS Server to share directory for clients in a specific network.



[root@server1 ~]# vi /etc/exports


/data 200.0.0.0/24(rw,sync)


:wq!
[root@server1 ~]# service nfsrestart
Shutting down NFS mountd: [ OK ]
Shutting down NFS daemon: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [ OK ]
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
[root@server1 ~]# showmount -e 200.0.0.1
Export list for 200.0.0.1:
/data 200.0.0.0/24





3. Configurations NFS Client.





[root@client1 ~]# showmount -e 200.0.0.1
Export list for 200.0.0.1:
/data 200.0.0.0/24
[root@client1 ~]# mount 200.0.0.1:/data /mnt
[root@client1 ~]# cd /mnt
[root@client mnt]# ll
total 0
-rw-r--r-- 1 root root 0 Aug 8 13:26 file1
-rw-r--r-- 1 root root 0 Aug 8 13:26 file2

[root@client2 ~]# showmount -e 200.0.0.1
Export list for 200.0.0.1:
/data 200.0.0.0/24
[root@client2 ~]# mount 200.0.0.1:/data /mnt
[root@client2 ~]# cd /mnt
[root@client mnt]# ll
total 0
-rw-r--r-- 1 root root 0 Aug 8 13:26 file1
-rw-r--r-- 1 root root 0 Aug 8 13:26 file2

Telnet Server And Client Config


Telnet Server And Client Config


Telnet server is used to login into another system. You can use the telnet command to log in remotely to another system on your network. The system can be on your local area network or available through an Internet connection.Telnet operates as if you were logging in to another system from a remote terminal. You will be asked for a login name and password. In effect, you are logging in to another account on another system. In fact, if you have an account on another system, you could use Telnet to log in to it.


Configurations Files

1. /etc/xinetd.d/telnet - Main Configuration File.

2. /etc/securetty - Contains list of the consoles allow to access for users to used log in remotely to another system.

3. /etc/hosts - Contains list of IP address allow to access telnet session from another systems.


Configuring Telnet Server.



[root@server1 ~]# yum install telnet*        …….
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Server | 1.3 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package telnet.i686 1:0.17-46.el6 set to be updated
---> Package telnet-server.i686 1:0.17-46.el6 set to be updated
--> Processing Dependency: xinetd for package: 1:telnet-server-0.17-46.el6.i686
--> Running transaction check
---> Package xinetd.i686 2:2.3.14-29.el6 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================
Package Arch Version Repository Size
===========================================================================
Installing:
telnet i686 1:0.17-46.el6 Server 56 k
telnet-server i686 1:0.17-46.el6 Server 36 k
Installing for dependencies:
xinetd i686 2:2.3.14-29.el6 Server 121 k

Transaction Summary
===========================================================================
Install 3 Package(s)
Upgrade 0 Package(s)

Total download size: 213 k
Installed size: 409 k
Is this ok [y/N]: y
Downloading Packages:
(1/3): telnet-0.17-46.el6.i686.rpm | 56 kB 00:00
(2/3): telnet-server-0.17-46.el6.i686.rpm | 36 kB 00:00
(3/3): xinetd-2.3.14-29.el6.i686.rpm | 121 kB 00:00
-----------------------------------------------------------------------------------------------------------------------------
Total 5.2 MB/s | 213 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 2:xinetd-2.3.14-29.el6.i686 1/3
Installing : 1:telnet-server-0.17-46.el6.i686 2/3
Installing : 1:telnet-0.17-46.el6.i686 3/3

Installed:
telnet.i686 1:0.17-46.el6 telnet-server.i686 1:0.17-46.el6

Dependency Installed:
xinetd.i686 2:2.3.14-29.el6
Complete!


[root@server1 ~]#vi /etc/xinetd.d/telnet    …….
# default: on
# description: The telnet server serves telnet sessions; it uses \
# unencrypted username/password pairs for authentication.
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure + = USERID
disable = yes
}

and modify this as follow

# default: on
# description: The telnet server serves telnet sessions; it uses \
# unencrypted username/password pairs for authentication.
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure + = USERID
disable = no
}


:wq!           …….



[root@server1 ~]# vi /etc/securetty       …….
console
vc/1
vc/2
vc/3
vc/4
vc/5
vc/6
vc/7
vc/8
vc/9
vc/10
vc/11
tty1
tty2
tty3
tty4
tty5
tty6
tty7
tty8
tty9
tty10
tty11

and modify this as follow
console
vc/1
vc/2
vc/3
vc/4
vc/5
vc/6
vc/7
vc/8
vc/9
vc/10
vc/11
tty1
tty2
tty3
tty4
tty5
tty6
tty7
tty8
tty9
tty10
tty11
pts/0
pts/1
pts/2


:wq!     …….



[root@server1 ~]#vi /etc/hosts …….
add client's and own machine ip adsress

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
200.0.0.1
200.0.0.100



:wq! …….

[root@server1 ~]# service xinetd restart …….
Stopping xinetd: [FAILED]
Starting xinetd: [ OK ]
[root@server1 ~]# chkconfig --level 35 xinetd on …….




Configuring Telnet Client.

[root@client ~]# yum install telnet …….
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Client | 1.3 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package telnet.i686 1:0.17-46.el6 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================
Package Arch Version Repository Size
===========================================================================
Installing:
telnet i686 1:0.17-46.el6 Client 56 k

Transaction Summary
===========================================================================
Install 1 Package(s)
Upgrade 0 Package(s)

Total download size: 56 k
Installed size: 102 k
Is this ok [y/N]: y
Downloading Packages:
telnet-0.17-46.el6.i686.rpm | 56 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 1:telnet-0.17-46.el6.i686 1/1

Installed:
telnet.i686 1:0.17-46.el6
Complete!


[root@client Desktop]# telnet 200.0.0.1  …….
Trying 200.0.0.1...
Connected to 200.0.0.1.
Escape character is '^]'.
Red Hat Enterprise Linux Server release 6.0 (Santiago)
Kernel 2.6.32-71.el6.i686 on an i686
login: root …….
Password: * * * * * …….
Last login: Sat May 20 20:32:31 on pts/2


[root@server1 ~]# ll …….
total 112
drwxr-xr-x. 11 root root 4096 May 20 21:19 1
-rw-------. 1 root root 1500 Jan 1 2013 anaconda-ks.cfg
drwxr-xr-x. 2 root root 4096 May 20 20:46 Desktop
drwxr-xr-x. 2 root root 4096 May 22 2011 Documents
drwxr-xr-x. 2 root root 4096 May 22 2011 Downloads
-rw-r--r--. 1 root root 45367 Jan 1 2013 install.log
-rw-r--r--. 1 root root 10565 Jan 1 2013 install.log.syslog
drwxr-xr-x. 2 root root 4096 May 22 2011 Music
-rw-r--r-- 1 root root 21 May 20 22:33 new1
drwxr-xr-x. 2 root root 4096 May 22 2011 Pictures
drwxr-xr-x. 2 root root 4096 May 22 2011 Public
drwxr-xr-x. 2 root root 4096 May 22 2011 Templates
drwxr-xr-x. 2 root root 4096 May 22 2011 Videos
-rw-r--r-- 1 root root 0 May 20 2000 welcome

[root@server1 ~]# rm-rf welcome …….


[root@server1 ~]# ll …….
drwxr-xr-x. 11 root root 4096 May 20 21:19 1
-rw-------. 1 root root 1500 Jan 1 2013 anaconda-ks.cfg
drwxr-xr-x. 2 root root 4096 May 20 20:46 Desktop
drwxr-xr-x. 2 root root 4096 May 22 2011 Documents
drwxr-xr-x. 2 root root 4096 May 22 2011 Downloads
-rw-r--r--. 1 root root 45367 Jan 1 2013 install.log
-rw-r--r--. 1 root root 10565 Jan 1 2013 install.log.syslog
drwxr-xr-x. 2 root root 4096 May 22 2011 Music
-rw-r--r-- 1 root root 21 May 20 22:33 new1
drwxr-xr-x. 2 root root 4096 May 22 2011 Pictures
drwxr-xr-x. 2 root root 4096 May 22 2011 Public
drwxr-xr-x. 2 root root 4096 May 22 2011 Templates
drwxr-xr-x. 2 root root 4096 May 22 2011 Videos

[root@server1 ~]#cat > new …….
Welcome to ITTables …….
CTRL+D …….
[root@server1 ~]#ll …….
drwxr-xr-x. 11 root root 4096 May 20 21:19 1
-rw-------. 1 root root 1500 Jan 1 2013 anaconda-ks.cfg
drwxr-xr-x. 2 root root 4096 May 20 20:46 Desktop
drwxr-xr-x. 2 root root 4096 May 22 2011 Documents
drwxr-xr-x. 2 root root 4096 May 22 2011 Downloads
-rw-r--r--. 1 root root 45367 Jan 1 2013 install.log
-rw-r--r--. 1 root root 10565 Jan 1 2013 install.log.syslog
drwxr-xr-x. 2 root root 4096 May 22 2011 Music
-rw-r--r-- 1 root root 21 May 20 22:33 new1
drwxr-xr-x. 2 root root 4096 May 22 2011 Pictures
drwxr-xr-x. 2 root root 4096 May 22 2011 Public
drwxr-xr-x. 2 root root 4096 May 22 2011 Templates
drwxr-xr-x. 2 root root 4096 May 22 2011 Videos
-rw-r--r-- 1 root root 0 May 20 2000 welcome
[root@server1 ~]# exit …….
Logout
Connection closed by foreign host.

[root@client ~]# telnet 200.0.0.1 …….
Trying 200.0.0.1...
Connected to 200.0.0.1.
Escape character is '^]'.
Red Hat Enterprise Linux Server release 6.0 (Santiago)
Kernel 2.6.32-71.el6.i686 on an i686
login: user1 …….
Password:***** …….
Last login: Sat May 20 23:08:34 from 200.0.0.2
[user1@server1 ~]$

For Latest Updates: Subscribe Now | | Test Your Knowledge, Take a Quiz now Click Here | | Site Best Viewed In Firefox

X