I have tried so many ways but finally happy with this
#!/bin/bash
for i in localhost 127.0.01
do
ssh raja@$i 'uptime | grep -o load.*'
done
The above script will produce load average from a remote system.
I am a Linux System Administrator , Who started my carrier in Jan 2014. I am writing this blog with issues,requirements etc things of a Linux System Administrator. I hope it will help you and Please contact me if you want to write.
I have tried so many ways but finally happy with this
#!/bin/bash
for i in localhost 127.0.01
do
ssh raja@$i 'uptime | grep -o load.*'
done
The above script will produce load average from a remote system.
In my approach , I am doing this in VmWare by choosing 3 virtual harddisks with equal 1 GB Size. Our first step is we need to make those harddisks as ready for RAID.
Today I am writing about how to create Software RAID. Creating Software RAID is pretty easy. All we need either 3 equal size partitions on different harddisks or 3 equal size harddisks.
WARNING: DOS-compatible mode is deprecated. It's strongly recommended toI am selecting new partition here as primary with default size ,( all my 3 VHDS having same size)
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): n
Command actionNow we have to change Partition type to RAID , so
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-130, default 130):
Using default value 130
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): fd ( fd for auto RAID)
Command (m for help): pAll good , we can commit our changes.
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x8a6b2eca
Device Boot Start End Blocks Id System
/dev/sdb1 1 130 1044193+ fd Linux raid autodetect
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Now we have to create RAID, Here I am choosing RAID 5 which needs minimum 3 RAID Harddisks
[root@ns1 sysadmin]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00092c9c
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 2611 20458496 8e Linux LVM
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x8a6b2eca
Device Boot Start End Blocks Id System
/dev/sdb1 1 130 1044193+ fd Linux raid autodetect
Disk /dev/sdc: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x6429c3f4
Device Boot Start End Blocks Id System
/dev/sdc1 1 130 1044193+ fd Linux raid autodetect
Disk /dev/sdd: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe883f58a
Device Boot Start End Blocks Id System
/dev/sdd1 1 130 1044193+ fd Linux raid autodetect
Disk /dev/mapper/VolGroup-lv_root: 18.9 GB, 18865979392 bytes
255 heads, 63 sectors/track, 2293 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/VolGroup-lv_swap: 2080 MB, 2080374784 bytes
255 heads, 63 sectors/track, 252 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
RAID 5 Created. --level indicates RAID level and after number and name of the devices.
[root@ns1 sysadmin]# mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
Then we have to save our RAID Configuration.
[root@ns1 sysadmin]# mdadm --detail /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Tue Nov 11 00:05:20 2014
Raid Level : raid5
Array Size : 2086912 (2038.34 MiB 2137.00 MB)
Used Dev Size : 1043456 (1019.17 MiB 1068.50 MB)
Raid Devices : 3
Total Devices : 3
Persistence : Superblock is persistent
Update Time : Tue Nov 11 00:05:26 2014
State : clean
Active Devices : 3
Working Devices : 3
Failed Devices : 0
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 512K
Name : ns1.example.com:0 (local to host ns1.example.com)
UUID : af2998ef:acc6cb1e:feb832f1:7f9b2f1b
Events : 18
Number Major Minor RaidDevice State
0 8 17 0 active sync /dev/sdb1
1 8 33 1 active sync /dev/sdc1
3 8 49 2 active sync /dev/sdd1
# wget http://pkgs.repoforge.org/lshw/lshw-2.17-1.el3.rf.i386.rpmAfter installing you can use it, simply type as lshw in the terminal.
# yum install lshw-2.17-1.el3.rf.i386.rpm
[root@localhost ~]# lshw | grep VGA
description: VGA compatible controller
product: SVGA II Adapter
[root@localhost ~]#

ldd /path/to/service | grep libwrap.so
ldd /var/sbin/sshd | grep libwrap.so
# vi /etc/hosts.deny
ALL: .developement.com : spawn /bin/echo %a from %h attempted to access %d >> /var/log/ssh.log:deny
sshd: .tech.com severity emerg
sshd: 192.168.1.2 : spwan /bin/echo `/bin/date` from %h >> /var/log/ssh.log : deny
# touch /etc/nologin
Protocol 2
# vi /etc/ssh/sshd_config
PermitRootLogin no
# vi /etc/ssh/sshd_config
AllowUsers user1 user2 user3
# vi /etc/ssh/sshd_config
# vi /etc/ssh/sshd_config
ClientAliveInterval 300
ClinetAliveCountMax 0
# vi /etc/ssh/sshd_config
Banner /etc/issue
# vi /etc/ssh/sshd_config
Port 2222
# vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2222 -j ACCEPT
# service iptables restart
-A INPUT -s 192.168.1.2/24 -m state --state NEW -m tcp -p tcp --dport 2222 -j ACCEPT
# service iptables restart
# vi /etc/ssh/sshd_config
ListenAddress 192.168.1.2/24
# vi /etc/hosts.allow
sshd : 192.168.1.2/24
# vi /etc/hosts.deny
sshd : 192.168.1.2/24
# vi /etc/ssh/sshd_config
PermitEmptyPasswords no
yum install openssh-server openssh-clients
service sshd start
service sshd stop
service sshd restart
service sshd status
vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
service iptables restart
yum install vsftpd ftp
vim /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
chroot_local_users=YES
useradd -d /path/path <username>
useradd -d /ftp/raja raja passwd raja
chkconfig --levels 235 vsftpd on
service vsftpd start
service vsftpd restart service vsftpd stop service vsftpd status
use_localtime=YES
listen_port=2121
vim /etc/sysconfig/iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport 2121 -j ACCEPT
service iptables restart
setenforce 0
getenforce
useradd -d /ftp/raja raja2
setfacl -m u:raja2:rwx /ftp/raja
ftp 192.168.1.1
ftp 192.168.1.1 4545
yum-config-manager --add-repo repository_urlEnable Repo:
yum-config-manager --enable repository…Disable Repo:
yum-config-manager --disable repository…
dd if=/path/to/ISO.iso of=/dev/sda bs=4M;syncThats it. Note: at of=/dev/sda dont give anything after your device. for example If your USB mounted as /dev/sdb1 then at of you should give as of=/dev/sdb only.
vi /etc/sysconfig/network-scripts/ifcfg-eth0There Place the content as
service network restart