Showing posts with label Redhat. Show all posts
Showing posts with label Redhat. Show all posts

Monday, August 25, 2014

Connecting SSH without Password in Linux



Secure Shell (SSH) is a cryptographic network protocol for secure data communication, remote command-line login, remote command execution, and other secure network services between two networked computers. It connects, via a secure channel over an insecure network, a server and a client running SSH server and SSH client programs, respectively


But we connect a system via SSH it will ask for password each time when we try to connect it. When we are running a script which need to connect a server via SSH port it will ask for password but we can enter it so to avoid this we are creating as pass-wordless login between the servers which helps to runs the script without any issue.


Create Authentication SSH-Kegen Keys on current machine

While we creating Authentication SSH_Keygen it will ask for path to store the file and pass phrase password the login. Don't enter any password in pass phrase just hit enter.

[root@linuxstorages ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): [Hit Enter]
Enter passphrase (empty for no passphrase): [Hit Enter]
Enter same passphrase again: [Hit Enter]
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
36:47:58:f2:03:ab:be:71:bd:99:c5:3f:87:56:13:27 root@localhost.localdomain
The key's randomart image is:
+--[ RSA 2048]----+
|        o .      |
|         B       |
|        o +      |
|       . . .  E..|
|      . S .    .o|
|     . . + .   ..|
|      o . . o  o.|
|       +   = .+ .|
|      .   +  ..o |
+-----------------+

By default it will go for RSA 2048 bit encryption if you feel need more strong encryption then can go for RSA 4096 bit encryption.

[root@linuxstorages ~]$ ssh-keygen -t rsa -b 4096
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): [Hit Enter]
Enter passphrase (empty for no passphrase): [Hit Enter]
Enter same passphrase again: [Hit Enter]
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
6c:c6:ac:12:5d:db:bb:88:12:ab:bf:a7:8e:e4:76:eb root@localhost.localdomain
The key's randomart image is:
+--[ RSA 4096]----+
|                 |
|                 |
|        .        |
|     . = o       |
|    . . S .      |
|    .. +   .     |
|  . .o.   .      |
| o..+... . .     |
| .+*E*. . .      |
+-----------------+

Move the public key to remote machine to make connection between machine.

[root@linuxstorages ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.1.200
The authenticity of host '192.168.1.200 (192.168.1.200' can't be established.
RSA key fingerprint is 59:0a:a0:7f:e2:cc:00:b8:19:fa:4e:4b:0c:72:5a:c0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.200' (RSA) to the list of known hosts.
root@192.168.1.200's password:
Now try logging into the machine, with "ssh 'root@192.168.1.200'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

You have new mail in /var/spool/mail/root

Login to remote host machine without password now and further.

[root@linuxstorages ~]$ ssh root@192.168.1.200
Last login: Sat Aug 23 15:09:48 2014 from 192.168.1.100

Check the machine ip address after login

[root@linuxstorages_1 ~]$ ifconfig
eth1      Link encap:Ethernet  HWaddr 38:60:77:9B:FA:16
          inet addr:192.168.1.200  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::3a60:77ff:fe9b:fa16/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4331151 errors:5 dropped:0 overruns:0 frame:3
          TX packets:2907478 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:433288023 (413.2 MiB)  TX bytes:661916311 (631.2 MiB)
          Interrupt:20 Memory:fe400000-fe420000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:538498 errors:0 dropped:0 overruns:0 frame:0
          TX packets:538498 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:67721587 (64.5 MiB)  TX bytes:67721587 (64.5 MiB)

Tuesday, July 8, 2014

RHEL 7 Installation - 6 Steps

Redhat has recently released RHEL7 Operating system.  Some of the Changes in RHEL7 are listed below as compare with RHEL 6 .


    
  • Default root file system is XFS
  • Linux 3.10 kernel.
  • A new systemctl command replaces chkconfig and service, although scripts allow you to still use the legacy commands.
  • Docker: The biggest new addition to RHEL 7 is tight integration of Docker, the explosively popular application-virtualization technology.
  • Boot-loader GRUB2
  • Samba 4.1 and BTRFS makes an appearance

In this article we will go through the installation steps of RHEL 7, we will be installating using DVD or ISO file .

Step:1 Download the Binary DVD ISO File


Only the registerd users & who have the subscription on redhat portal can download the iso file of RHEL7. 

Use the link " Download RHEL7 Binary Dvd ISO file" Once you have download the ISO file , Burn the ISO file to DVD media or create bootable USB media as per requirement.

Step:2 Boot the system from the bootable disk and select "Install Red Hat Enterprise Linux 7.0"  :


Red Hat Enterprise Linux 7 (RHEL7) Installation Steps with Screenshots

Step:3 Select the language that will be used during installation

Red Hat Enterprise Linux 7 (RHEL7) Installation Steps with Screenshots

Click on Continue...

Step:4 Set Customize installation options:

Red Hat Enterprise Linux 7 (RHEL7) Installation Steps with Screenshots

  • Adjust Date & Time, Keyboard, and Language Support preferences under Localization.
  • Modify Installation Source, Software Selection, and Network Configuration  options   under Software.
  • Under System : I have created customize partition table by clicking on the Installation Destination , preview of my customize partition table shown below :

Red Hat Enterprise Linux 7 (RHEL7) Installation Steps with Screenshots

Now Finally click on "Begin Installation"

Step:5 Set the root password & Create a system user

Red Hat Enterprise Linux 7 (RHEL7) Installation Steps with Screenshots

As we can see above installation has started. Once the installation is completed it will ask fro reboot.

Step:6 Reboot the Machine , after installation is completed :

Red Hat Enterprise Linux 7 (RHEL7) Installation Steps with Screenshots

click on Reboot

Step:7 Console after OS Installation

Red Hat Enterprise Linux 7 (RHEL7) Installation Steps with Screenshots

Monday, July 7, 2014

Boot Process in Linux - 6 Stages

6 Stages of Linux Boot Process



1. BIOS

BIOS stands for Basic Input/Output System

Performs some system integrity checks

Searches, loads, and executes the boot loader program.

It looks for boot loader in floppy, cd-rom, or hard drive. You can press a key (typically F12 of F2, but it depends on your system) during the BIOS startup to change the boot sequence.

Once the boot loader program is detected and loaded into the memory, BIOS gives the control to it.
So, in simple terms BIOS loads and executes the MBR boot loader.

2. MBR

MBR stands for Master Boot Record.

It is located in the 1st sector of the bootable disk. Typically /dev/hda, or /dev/sda

MBR is less than 512 bytes in size. This has three components

1) primary boot loader info in 1st 446 bytes
2) partition table info in next 64 bytes
3) mbr validation check in last 2 bytes.

It contains information about GRUB (or LILO in old systems).

So, in simple terms MBR loads and executes the GRUB boot loader.

3. GRUB

GRUB stands for Grand Unified Bootloader.

If you have multiple kernel images installed on your system, you can choose which one to be executed.

GRUB displays a splash screen, waits for few seconds, if you don’t enter anything, it loads the default kernel image as specified in the grub configuration file.

GRUB has the knowledge of the filesystem (the older Linux loader LILO didn’t understand filesystem).
Grub configuration file is /boot/grub/grub.conf (/etc/grub.conf is a link to this). The following is sample grub.conf of CentOS.
root@linuxstorages:~#cat /etc/grub.conf 
‪#‎boot‬=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-194.el5PAE)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-194.el5PAE ro root=LABEL=/
initrd /boot/initrd-2.6.18-194.el5PAE.img
As you notice from the above info, it contains kernel and initrd image.
So, in simple terms GRUB just loads and executes Kernel and initrd images.

4. Kernel

Mounts the root file system as specified in the “root=” in grub.conf

Kernel executes the /sbin/init program

Since init was the 1st program to be executed by Linux Kernel, it has the process id (PID) of 1. Do a ‘ps -ef | grep init’ and check the pid.

initrd stands for Initial RAM Disk.

initrd is used by kernel as temporary root file system until kernel is booted and the real root file system is mounted. It also contains necessary drivers compiled inside, which helps it to access the hard drive partitions, and other hardware.

5. Init

Looks at the /etc/inittab file to decide the Linux run level.

Following are the available run levels
0 – halt
1 – Single user mode
2 – Multiuser, without NFS
3 – Full multiuser mode
4 – unused
5 – X11
6 – reboot
Init identifies the default initlevel from /etc/inittab and uses that to load all appropriate program.

Execute ‘grep initdefault /etc/inittab’ on your system to identify the default run level

If you want to get into trouble, you can set the default run level to 0 or 6. Since you know what 0 and 6 means, probably you might not do that.

Typically you would set the default run level to either 3 or 5.

6. Runlevel programs

When the Linux system is booting up, you might see various services getting started. For example, it might say “starting sendmail …. OK”. Those are the runlevel programs, executed from the run level directory as defined by your run level.

Depending on your default init level setting, the system will execute the programs from one of the following directories.
Run level 0 – /etc/rc.d/rc0.d/
Run level 1 – /etc/rc.d/rc1.d/
Run level 2 – /etc/rc.d/rc2.d/
Run level 3 – /etc/rc.d/rc3.d/
Run level 4 – /etc/rc.d/rc4.d/
Run level 5 – /etc/rc.d/rc5.d/
Run level 6 – /etc/rc.d/rc6.d/
Please note that there are also symbolic links available for these directory under /etc directly. So, /etc/rc0.d is linked to /etc/rc.d/rc0.d.

Under the /etc/rc.d/rc*.d/ directories, you would see programs that start with S and K.

Programs starts with S are used during startup. S for startup.

Programs starts with K are used during shutdown. K for kill.

There are numbers right next to S and K in the program names. Those are the sequence number in which the programs should be started or killed.

For example, S12syslog is to start the syslog deamon, which has the sequence number of 12. S80sendmail is to start the sendmail daemon, which has the sequence number of 80. So, syslog program will be started before sendmail.






Thursday, July 3, 2014

How To Clear Memory Cache in Linux

Clearning the Linux Memory cache can be a quick way to regain system resources. Writing to the drop_cache process will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.



    To free pagecache:                                      # echo 1 > /proc/sys/vm/drop_caches

    To free dentries and inodes:                      # echo 2 > /proc/sys/vm/drop_caches

    To free pagecache, dentries and inodes :  # echo 3 > /proc/sys/vm/drop_caches

As this is a non-destructive operation, and dirty objects are not freeable, the user should run "sync" first in order to make sure all cached objects are freed.

Example - Memory before:

[root@linuxstorages ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          3763       3630        132          0       1374        147
-/+ buffers/cache:       2108       1655
Swap:         4095         22       4073


[root@linuxstorages ~]# sync


[root@linuxstorages ~]# echo 3 > /proc/sys/vm/drop_caches

Memory after:

[root@linuxstorages ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          3763       1083       2680          0          2         84
-/+ buffers/cache:        996       2767
Swap:         4095         22       4073

Tuesday, June 24, 2014

How to Configure Name Based Web Server in Linux

Red Hat® Certified Engineer (RHCE®) is a Red Hat Certified System Administrator (RHCSA) who possesses additional skills, knowledge, and abilities required of a senior system administrator responsible for Red Hat Enterprise Linux® systems.

An RHCE is capable of:

    Configuring static routes, packet filtering, and network address translation.
    Setting kernel runtime parameters.
    Configuring an Internet Small Computer System Interface (iSCSI) initiator.
    Producing and delivering reports on system utilization.
    Using shell scripting to automate system maintenance tasks.
    Configuring system logging, including remote logging.
    Configuring a system to provide networking services, including HTTP/HTTPS, File Transfer        Protocol(FTP), network file system (NFS), server message block (SMB), Simple Mail Transfer Protocol (SMTP), secure shell (SSH) and Network Time Protocol (NTP).



How to create multiple virtual host using name based virtual host.

First install web server in system

root@linuxstorage:~#yum install https* -y

configure the httpd configuration file   



root@linuxstorage:~# vi /etc/httpd/conf/httpd.conf

to enable Name Based virtual host change line by removing symbol in front of line

 #NameVirtualHost *:80
     to

 NameVirtualHost xx.xx.xx.xx(Domain ip ):80

 copy last 7 line of sample and paste it below, then edit it as given below

#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>


change like this

<VirtualHost xx.xx.xx.xx:80>
    ServerAdmin webmaster@linuxstorages.com
    DocumentRoot /var/www/html/sample1
    ServerName sample1.com
    ErrorLog logs/
sample1.com-error_log
    CustomLog logs/
sample1.com-access_log common
</VirtualHost>

 <VirtualHost xx.xx.xx.xx:80>
    ServerAdmin webmaster@linuxstorages.com
    DocumentRoot /var/www/html/sample2
    ServerName sample2.com
    ErrorLog logs/
sample2.com-error_log
    CustomLog logs/
sample2.com-access_log common
</VirtualHost>



:wq!

Both sample1.com and sample2.com domains will have same ip address. Like this we can create more sites using single ip address with help of name based virtual host.

Both virtual host have different document root.

Now we can move file to particular document root. 



    root@linuxstorage:~#cd  /var/www/html/sample1

    root@linuxstorage:~#vi index.html

    test1

    :wq!

    root@linuxstorage:~#cd  /var/www/html/sample2

    root@linuxstorage:~#vi index.html

    test2

    :wq!



root@linuxstorage:~#httpd -s

check the configuration status with help of above command and now restart the web server service



root@linuxstorage:~#service httpd restart

check the domain names in URL or elinks command.


    root@linuxstorage:~#elinks http://sample1.com
    test1

    or

    root@linuxstorage:~#elinks http://sample2.com
    test2

Saturday, June 21, 2014

How to Configure a WebServer in Linux

Red Hat® Certified Engineer (RHCE®) is a Red Hat Certified System Administrator (RHCSA) who possesses additional skills, knowledge, and abilities required of a senior system administrator responsible for Red Hat Enterprise Linux® systems.

An RHCE is capable of:

    Configuring static routes, packet filtering, and network address translation.
    Setting kernel runtime parameters.
    Configuring an Internet Small Computer System Interface (iSCSI) initiator.
    Producing and delivering reports on system utilization.
    Using shell scripting to automate system maintenance tasks.
    Configuring system logging, including remote logging.
    Configuring a system to provide networking services, including HTTP/HTTPS, File Transfer        Protocol(FTP), network file system (NFS), server message block (SMB), Simple Mail Transfer Protocol (SMTP), secure shell (SSH) and Network Time Protocol (NTP).







Implement a webserver


CMD:

Install web server packages using yum command


root@linuxstorages:~#yum install httpd* -y


Configure the web server configuration in below path


root@linuxstorages:~#vim /etc/httpd/conf/httpd.conf




Copy the last 7 line and paste in last. Then change all dummy into your hostname

Change document root is /var/www/html

:wq!   
 Change directory to document root of web server


root@linuxstorages:~#cd /var/www/html

Connect FTP server using lftp command 


root@linuxstorages:~#lftp server id

>cd /var/www/ftp

>get data.html
>bye

get - download file from server to local

bye - exit ftp server connection

Rename data.html to index.html


root@linuxstorages:~#mv data.html index.html

Enter ip address details in host file


root@linuxstorages:~#vim /etc/hosts

Add   ipaddress    hostname(fully)        hostname(half)
               
xx.xx.xx.xx    user.linuxstorages.com   user.linuxstorages

:wq!

Check status of web server configuration file after configuring


         root@linuxstorages:~#httpd -t
         syntax ok

        root@linuxstorages:~#service httpd restart

        root@linuxstorages:~#chkconfig httpd on

Check the URL using elinks command in terminal


root@linuxstorages:~#elinks user.linuxstorages.com

Friday, June 20, 2014

RHEL 7 Features

Red Hat has launched Red Hat Enterprise Linux 7 beta which will introduce a variety of new virtualization, cloud, networking, file system, and live update features.

Celebrating the launch of Red Hat Enterprise Linux 7! Check out the features: http://red.ht/overviewrhel7 #RHEL7 #RedHat





File systems have continued to be a major focus of development in within RHEL. XFS is currently the default file system in RHEL 7, allowing support file systems as large as 500TB. But scalability enhancements to ext4 file systems allow them to be 16TB to 50TB standalone with block sizes of up to 1MB.

This simplifies and speeds up block allocation and defragmentation. Emerging file system Btrfs is available as a technology preview within Red Hat Enterprise Linux 7.

Networking is now faster (with 40Gb Ethernet link support), more responsive, and includes TCP Fast Open and Early Retransmit for TCP.



Friday, June 13, 2014

How to Mount Windows NTFS Partition in Linux

First you need to enable EPEL (Extra Packages for Enterprise Linux) Repository. You may refer the article on how to enable EPEL Repository under RHEL, CentOS and Fedora systems.

To mount any NTFS based filesystem, you need to install a tool called NTFS3G. Before heading up for installation let’s understand NTGS3G.








What is NTFS3G


NTFS3G is an open source cross-platform, stable, GPL licensed, POSIX, NTFS R/W driver used in Linux. It provides safe handling of Windows NTFS file systems viz create, remove, rename, move files, directories, hard links, etc.

Once EPEL is installed and enabled, let’s install ntfs-3g package using the below command with root user.

root@linuxstorages:~# yum -y install ntfs-3g

Fuse Install

Next, install and load FUSE driver to mount detected devices with below command. FUSE module is included in the kernel itself in version 2.6.18-164 or newer.

  root@linuxstorages:~# yum install fuse

  root@linuxstorages:~# modprobe fuse

Identify NTFS Partition

Once fuse module is loaded, type below command to find out NTFS Partitions in Linux.

root@linuxstorages:~# fdisk -l

Device Boot Start End Blocks Id System
/dev/sdb1 1 21270 7816688 b W95 FAT32


Mount NTFS partition

First create a mount point to mount the NTFS partition.
 

root@linuxstorages:~# mkdir /mnt/nts

Simply run the following command to mount the partition. Replace sda1 with your actual partition found.

root@linuxstorages:~# mount -t ntfs-3g /dev/sda1 /mnt/nts

Once it’s mounted on /mnt/ntfs, you may use regular Linux ls -l command to list the content of mounted filesystem.

Thursday, June 5, 2014

How To Configure Samba Server In Linux

Red Hat® Certified Engineer (RHCE®) is a Red Hat Certified System Administrator (RHCSA) who possesses additional skills, knowledge, and abilities required of a senior system administrator responsible for Red Hat Enterprise Linux® systems.

An RHCE is capable of:

    Configuring static routes, packet filtering, and network address translation.
    Setting kernel runtime parameters.
    Configuring an Internet Small Computer System Interface (iSCSI) initiator.
    Producing and delivering reports on system utilization.
    Using shell scripting to automate system maintenance tasks.
    Configuring system logging, including remote logging.
    Configuring a system to provide networking services, including HTTP/HTTPS, File Transfer        Protocol(FTP), network file system (NFS), server message block (SMB), Simple Mail Transfer Protocol (SMTP), secure shell (SSH) and Network Time Protocol (NTP).








 Share the /central directory via SMB:


CMD:

Install smaba packages using yum 


 root@linuxstorages:~#yum install samba* -y

Configure samba configuration file 


    root@linuxstorages:~#vim /etc/samba/smb.conf
    change workgroup as STAFF in line no 74

                   Add

    
                   [common]

                    Path = /central


                    Browseable = yes


                    Writeable = yes


                    Host allow = 192.168.0.


                    Valid user = sowmya


    :wq



Create shared directory



root@linuxstorages:~#mkdir /central

Create samba user and password 


root@linuxstorages:~#smbpasswd -a sowmya

Use this command if selinux is enabled for selinux permission


root@linuxstorages:~#chcon -Rt samba_share_t   /central   

Restart samba service and enable in chkconfig


root@linuxstorages:~#service smb restart

root@linuxstorages:~#chkconfig smb on

check the share directory with the ipaddress  


root@linuxstorages:~#smbclient //ipaddress/common -U sowmya  
 

Monday, June 2, 2014

How To Configure FTP Access In Linux

Red Hat® Certified Engineer (RHCE®) is a Red Hat Certified System Administrator (RHCSA) who possesses additional skills, knowledge, and abilities required of a senior system administrator responsible for Red Hat Enterprise Linux® systems.

An RHCE is capable of:

    Configuring static routes, packet filtering, and network address translation.
    Setting kernel runtime parameters.
    Configuring an Internet Small Computer System Interface (iSCSI) initiator.
    Producing and delivering reports on system utilization.
    Using shell scripting to automate system maintenance tasks.
    Configuring system logging, including remote logging.
    Configuring a system to provide networking services, including HTTP/HTTPS, File Transfer        Protocol(FTP), network file system (NFS), server message block (SMB), Simple Mail Transfer Protocol (SMTP), secure shell (SSH) and Network Time Protocol (NTP).





 Configure FTP access on your system


CMD:

First install FTP packages in your system


root@linuxstorages:~#yum install vsftpd* -y

Edit hosts.deny file for deny particular domain


root@linuxstorages:~#vim /etc/hosts.deny

ADD following line in this file

vsftpd:              ALL EXCEPT               *.linuxstoraages.com


:wq!

Restart FTP service after change in configuration file



root@linuxstorages:~#service vsftpd restart

Add a ftp service in chkconfig


root@linuxstorages:~#chkconfig vsftpd on

How To Configure SSH Access In Linux

Red Hat® Certified Engineer (RHCE®) is a Red Hat Certified System Administrator (RHCSA) who possesses additional skills, knowledge, and abilities required of a senior system administrator responsible for Red Hat Enterprise Linux® systems.

An RHCE is capable of:

    Configuring static routes, packet filtering, and network address translation.
    Setting kernel runtime parameters.
    Configuring an Internet Small Computer System Interface (iSCSI) initiator.
    Producing and delivering reports on system utilization.
    Using shell scripting to automate system maintenance tasks.
    Configuring system logging, including remote logging.
    Configuring a system to provide networking services, including HTTP/HTTPS, File Transfer        Protocol(FTP), network file system (NFS), server message block (SMB), Simple Mail Transfer Protocol (SMTP), secure shell (SSH) and Network Time Protocol (NTP).





Configure SSH access


CMD:

Install SSH server in your system using yum command


root@linuxstorages:~#yum install open-ssh-server* -y


Block  ip which need to in hosts.deny file


root@linuxstorages:~#vim /etc/hosts.deny

ADD following line in this file

sshd:            192.168.1.1/255.255.255.0

:wq!  (save file)

Restart the SSH service after changing configuration file


root@linuxstorages:~#service sshd restart

Enable in chkconfig service


root@linuxstorages:~#chkconfig sshd on

Thursday, May 29, 2014

How To Resize Logical Partition (LVM) In Linux

A Red Hat Certified System Administrator (RHCSA) is able to perform the following tasks:

  • Understand and use essential tools for handling files, directories, command-line environments, and documentation
  • Operate running systems, including booting into different run levels, identifying processes, starting and stopping virtual machines, and controlling services
  • Configure local storage using partitions and logical volumes
  • Create and configure file systems and file system attributes, such as permissions, encryption, access control lists, and network file systems
  • Deploy, configure, and maintain systems, including software installation, update, and core services
  • Manage users and groups, including use of a centralized directory for authentication
  • Manage security, including basic firewall and SELinux configuration.




Resize your logical partition to 950Mb and resize your logical volume to 150Mb.

CMD:

To increase the partition size use following commands,

root@linuxstorage:~#df -h

root@linuxstorage:~#lvextend -L 950M /dev/mapper/vgsrv-home

lvextend - extend the size of a logical volume.

Resize your file system with resize2fs


root@linuxstorage:~#resize2fs /dev/mapper/vgsrv-home
CMD: 

To reduce the partition size use following commands,

root@linuxstorage:~#df -h

Unmount the partition

root@linuxstorage:~#unmount /home

Run fsck on your file system



    root@linuxstorage:~#e2fsck -f /dev/mapper/vgsrv-home
    e2fsck 1.41.12
    Pass 1: Checking inodes, blocks, and sizes
    Pass 2: Checking directory structure
    Pass 3: Checking directory connectivity
    Pass 4: Checking reference counts
    Pass 5: Checking group summary information
 


Resize your file system with resize2fs

root@linuxstorage:~#resize2fs /dev/mapper/vgsrv-home 150M

Lvreduce - reduce the size of a logical volume

root@linuxstorage:~#lvreduce -L 150M /dev/mapper/vgsrv-home


Remount the partition

root@linuxstorage:~#mount -a

How To Configure FTP Server In Linux

A Red Hat Certified System Administrator (RHCSA) is able to perform the following tasks:

  • Understand and use essential tools for handling files, directories, command-line environments, and documentation
  • Operate running systems, including booting into different run levels, identifying processes, starting and stopping virtual machines, and controlling services
  • Configure local storage using partitions and logical volumes
  • Create and configure file systems and file system attributes, such as permissions, encryption, access control lists, and network file systems
  • Deploy, configure, and maintain systems, including software installation, update, and core services
  • Manage users and groups, including use of a centralized directory for authentication
  • Manage security, including basic firewall and SELinux configuration.




Configure a FTP server which is anonymous download to all user in your network and allow the user without authentication.

CMD:

VSFTPD stands for "Very Secure FTP Daemon" is a GPL licensed FTP server for UNIX systems. It supports IPv6 and SSL. vsftpd supports explicit (since 2.0.0) and implicit (since 2.1.0) FTPS. vsftpd is the default FTP server in the Ubuntu, CentOS, Fedora, NimbleX, Slackware and RHEL Linux distributions. It is secure and extremely fast.

 It is stable. VSFTPD is a mature and trusted solution which supports virtual users with PAM (pluggable authentication modules). A virtual user is a user login which does not exist as a real login on the system in /etc/passwd and /etc/shadow file. Virtual users can therefore be more secure than real users, because a compromised account can only use the FTP server but cannot login to system to use other services such as SSH or SMTP.

root@linuxstorage:~#yum install vsftpd* -y

First install vsftpd and relative packages using yum command.

root@linuxstorage:~#vim /etc/vsftpd/vsftpd.conf

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES

Check line number 12 in configuration. Enable anonymous_enable=YES by removing # symbol in front of it.

root@linuxstorage:~#service vsftpd restart

After changing the configuration restart and enable chkconfig service for ftp.

root@linuxstorage:~#chkconfig vsftpd on


How To Schedule Cron Job For Users In Linux

A Red Hat Certified System Administrator (RHCSA) is able to perform the following tasks:


  • Understand and use essential tools for handling files, directories, command-line environments, and documentation
  • Operate running systems, including booting into different run levels, identifying processes, starting and stopping virtual machines, and controlling services
  • Configure local storage using partitions and logical volumes
  • Create and configure file systems and file system attributes, such as permissions, encryption, access control lists, and network file systems
  • Deploy, configure, and maintain systems, including software installation, update, and core services
  • Manage users and groups, including use of a centralized directory for authentication
  • Manage security, including basic firewall and SELinux configuration.



Schedule cron job for user sowmya that every day "GoodMorning" message should be displayed at 19.27.

CMD:


root@linuxstorage:~#crontab -u sowmya -e

27             19         *              *              *              /bin/echo "hello"

:wq!

u    - Users
e    - Edit the file

32 -  Minutes
16 -  Hours ( 4 pm )
*   -  Every day
*   -  Every month
*   -  Every week                                    


wq! - save file

Cron will run every day at 7.27 pm.


root@linuxstorage:~#crontab -u sowmya -l

l = Print scheduled cron. 


root@linuxstorage:~#service crond restart

Enter the crond service in chkconfig

root@linuxstorage:~#chkconfig crond on

Wednesday, May 28, 2014

How To Create Web Server In Linux

A Red Hat Certified System Administrator (RHCSA) is able to perform the following tasks:


  • Understand and use essential tools for handling files, directories, command-line environments, and documentation
  • Operate running systems, including booting into different run levels, identifying processes, starting and stopping virtual machines, and controlling services
  • Configure local storage using partitions and logical volumes
  • Create and configure file systems and file system attributes, such as permissions, encryption, access control lists, and network file systems
  • Deploy, configure, and maintain systems, including software installation, update, and core services
  • Manage users and groups, including use of a centralized directory for authentication
  • Manage security, including basic firewall and SELinux configuration.




Create a web server

Set document root to   /var/www/html

CMD:

root@linuxstorage:~#yum install httpd* -y

root@linuxstorage:~#vim /etc/httpd/conf/httpd.conf   (configuration path for web server)

#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

copy the last 7 line and paste in last and change all dummy host in your hostname

change document root to /var/www/html

:wq   (save file)

root@linuxstorage:~#httpd -S    (to check above configuration is correct or not)

root@linuxstorage:~#httpd -t    (to check above configuration is correct or not)

root@linuxstorage:~#cd /var/www/html     (change directory to document root )

root@linuxstorage:~#vi index.html      (add some content in index.html to check )

Restart web server service after all configuration

root@linuxstorage:~#service httpd restart

Make sure httpd service is on in chkconfig so while server restarts this service will also will start if now we should manually start the service.So please on the service in chkconfig.



root@linuxstorage:~#chkconfig httpd on 

To check the web server in command line


root@linuxstorage:~#elinks httpd://linuxstorages.com

This will display the content of index.html which means our configuration is correct.

How To Create User With Particular UUID In Linux

A Red Hat Certified System Administrator (RHCSA) is able to perform the following tasks:


  • Understand and use essential tools for handling files, directories, command-line environments, and documentation
  • Operate running systems, including booting into different run levels, identifying processes, starting and stopping virtual machines, and controlling services
  • Configure local storage using partitions and logical volumes
  • Create and configure file systems and file system attributes, such as permissions, encryption, access control lists, and network file systems
  • Deploy, configure, and maintain systems, including software installation, update, and core services
  • Manage users and groups, including use of a centralized directory for authentication
  • Manage security, including basic firewall and SELinux configuration.



 How to create a user sowmya with UUID 199


CMD
root@linuxstorage:~#useradd -u 199 sowmya

root@linuxstorage:~#id sowmya
uid=199(sowmya) gid=1001(sowmya) groups=1001(sowmya)

id - this command use to check user details.

 

© 2014 Linux Storages | Updated . All rights resevered. Designed by Templateism