This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Saturday, December 9, 2017

NTP client configuration in Windows Server - PowerShell

Saturday, December 09, 2017 0
Below procedure is used to configure NTP  client on windows server (power shell commands)

Open Power Shell as Administrator

Run the below commands

PS C:\Users\testuser>w32tm /config /manualpeerlist:"0.rhel.pool.ntp.org 1.rhel.pool.ntp.org 2.rhel.pool.ntp.org 3.rhel.pool.ntp.org 0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org" /syncfromflags:MANUAL

PS C:\Users\testuser>Stop-Service w32time
PS C:\Users\testuser>Start-Service w32time

PS C:\Users\testuser>w32tm /query /status

PS C:\Users\testuser> w32tm /query /status
Leap Indicator: 0(no warning)
Stratum: 3 (secondary reference - syncd by (S)NTP)
Precision: -6 (15.625ms per tick)
Root Delay: 0.0625000s
Root Dispersion: 0.3055127s
ReferenceId: 0xAC18000B (source IP:  172.0.0.11)
Last Successful Sync Time: 12/7/2017 8:44:49 AM
Source: 0.rhel.pool.ntp.org
Poll Interval: 15 (32768s)

PS C:\Users\testuser>w32tm /resync

Friday, December 8, 2017

Tree command in Linux Brief Explaination

Friday, December 08, 2017 0

Tree command is used to recursively check the number of files in folder.

tree - list contents of directories in a tree-like format

Tree is a recursive directory listing program that produces a depth indented listing of files. With no arguments, tree lists the files in the current directory.  When directory arguments are given, tree lists all the files and/or directories found in the given directories each in turn.  Upon completion of  listing all files/directories found, tree returns the total number of files and/or directories listed.

[root@testserver nsk]# tree -iLf 1 /home/nsk/
/home/nsk/
/home/nsk//audit.txt
/home/nsk//audit1.txt
/home/nsk//auditprod.txt
/home/nsk//auditprod1.txt
/home/nsk//dom
/home/nsk//ser.txt
/home/nsk//serv.txt
/home/nsk//serv1.txt
/home/nsk//server.txt
/home/nsk//umount
/home/nsk//umount-ser
/home/nsk//umount-ser1

0 directories, 12 files

Where:
    -i   Makes tree not print the indentation lines, useful when used in conjunction with the -f option.
    -L level Max display depth of the directory tree.

Thursday, December 7, 2017

OpenLdap user login issue asking to enter password again and again

Thursday, December 07, 2017 0
Situation:

              Openldap user is having issue while login to the server, it is asking password again and again.


Solution:

             Restart nslcd service. 

[root@testserver~]# /etc/init.d/nslcd restart
Stopping nslcd:                                            [  OK  ]
Starting nslcd:                                              [  OK  ]

NAME
       nslcd - local LDAP name service daemon. nslcd is a daemon that will do LDAP queries for local processes based on a simple configuration file.

Home directory Error oddjob-mkhomedir not working

Thursday, December 07, 2017 0

Home directory Error oddjob-mkhomedir not working

Situation:
While login as user, getting Error  oddjob-mkhomedir not working 

Solution:
1. yum install dbus oddjob oddjob-mkhomedir
2. service restart messagebus
3. service restart oddjob
4. Add the line "session required pam_oddjob_mkhomedir.so" to /etc/pam.d/sshd  file
5. Delete a users home directory (rm -rf /home/nskselvan)
6. Disable and enable the "Use LDAP Authentication" in authconfig-tui (authconfig-tui - an interface for configuring system authentication resources)
7. Log in using ssh as this user.

[root@testserver ~]# yum install dbus oddjob oddjob-mkhomedir
Setting up Install Process
Package 1:dbus-1.2.24-8.0.1.el6_6.x86_64 already installed and latest version
Package oddjob-0.30-5.el6.x86_64 already installed and latest version
Package oddjob-mkhomedir-0.30-5.el6.x86_64 already installed and latest version
Nothing to do

[root@testserver ~]# service  messagebus restart
Stopping system message bus:                               [  OK  ]
Starting system message bus:                                 [  OK  ]
[root@testserver ~]# chkconfig messagebus on
[root@testserver ~]# /etc/init.d/oddjobd status
oddjobd is stopped
[root@testserver ~]# /etc/init.d/oddjobd restart
Shutting down oddjobd:                                           [FAILED]
Starting oddjobd:                                                       [  OK  ]
[root@testserver ~]# /etc/init.d/oddjobd restart
Shutting down oddjobd:                                            [  OK  ]
Starting oddjobd:                                                       [  OK  ]
[root@testserver ~]# chkconfig oddjobd on

[root@testserver ~]# cat /etc/pam.d/sshd |  grep -i pam_oddjob_mkhomedir.so
#%PAM-1.0
session    required     pam_oddjob_mkhomedir.so

[root@testserver ~]# authconfig-tui
Here, disable (unselect)  the Use LDAP Authentication and save

[root@testserver ~]# authconfig-tui
Here, Enable (Select) the Use LDAP authentication and save. The result will be like below.
Starting nscd:                                             [  OK  ]
Starting nslcd:                                            [  OK  ]

Wednesday, December 6, 2017

Integrated Lights Out Manager Command to Turn On or Turn Off the Locator Indicator Remotely

Wednesday, December 06, 2017 0

Integrated Lights Out Manager Command  to Turn On or Turn Off  the Locator Indicator Remotely  

Below  Integrated Lights Out Manager Command is used to Turn On or Turn Off  the locator indicator .

Turn on the Locator indicator, type the following command at the  ILOM prompt:
set /System/ locator_indicator=on

Turn off the Locator indicator, type the following command at the ILOM prompt:
set /System/ locator_indicator=off

–> show /System/ locator_indicator

The output of the command appears:

/System

Properties:

locator_indicator = Off

The value locator_indicator shows the status as either On or Off.

Tuesday, December 5, 2017

How do you findout the Hardware and CPU Architecture BIT value in Linux

Tuesday, December 05, 2017 0

Findout the Hardware and CPU Architecture BIT value in Linux 

We can check the Hardware and CPU Supporting architecture by using below commands in Linux.

lscpu - display information about the CPU architecture
[root@testserver ~]# lscpu | egrep -i "CPU|Arch"
Architecture:                 x86_64
CPU op-mode(s):        32-bit, 64-bit
[root@testserver ~]#

[root@testserver ~]# file /sbin/init
/sbin/init: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

 Print machine architecture.
[root@testserver ~]# arch
x86_64

uname - print system information
 -m, --machine    print the machine hardware name
[root@testserver ~]# uname -m
x86_64

-p, --processor   print the processor type or "unknown"
[root@testserver ~]# uname -p
x86_64

-i, --hardware-platform   print the hardware platform or "unknown"
[root@testserver ~]# uname -i
x86_64

getconf - get configuration values
[root@testserver ~]# getconf LONG_BIT
64

Monday, December 4, 2017

SSH password less authentication between inux server by using ssh keygen

Monday, December 04, 2017 0
ssh (SSH client) is a program for logging into a remote machine and for executing commands on a remote machine.  It is intended to replace rlogin and rsh, and provide secure encrypted communications between two untrusted hosts over an insecure network.

SSH server : 10.0.0.35
SSH Remote server : 10.0.0.40

Here we are going to setup password less authentication from SSH server to SSH Remote Server.

SSH KEYGEN: ssh-keygen generates, manages and converts authentication keys for ssh.  The type of key to be generated is specified with the -t option.  If invoked without any arguments, ssh-keygen will generate an RSA key for use in SSH protocol 2      connections.

Genarate Keys on Server 10.0.0.35

[linvirtshell@nsk ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/linvirtshell/.ssh/id_rsa):
Created directory '/home/linvirtshell/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/linvirtshell/.ssh/id_rsa.
Your public key has been saved in /home/linvirtshell/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:8fcOx3W45JXn3651mNDK+YvL0b3jn8382MhXRFiUQ44 linvirtshell@nsk
The key's randomart image is:
+---[RSA 2048]----+
|              .=+|
|              +o.|
|        .    E o.|
|         o   . .o|
|        S . o +o=|
|           o X O+|
|            * X *|
|           . O OO|
|            +.XO#|
+----[SHA256]-----+
[linvirtshell@nsk ~]$

Create .ssh directory on Remote Server (10.0.0.40)

Login to the server 10.0.0.40 and create .ssh directory under /home/nsk
[nsk@nsk .ssh]$ mkdir .ssh
[nsk@nsk .ssh]$ ls -al | grep -i .ssh
drwx------. 2 nsk nsk  6 Dec  4 11:25 .ssh

Here .ssh should be 0700 permission, under .ssh create authorized_keys file, it should be 0600 permission.

Now copy the id_rsa.pub key  from 10.0.0.35 and paste the same in authorized_keys  file in 10.0.0.40.

Now login from server 10.0.0.35 to 10.0.0.40 as user nsk

[linvirtshell@nsk ~]$ ssh nsk@10.0.0.40
Last login: Mon Dec  4 11:39:20 2017 from nsk
[nsk@nsk ~]$

Sunday, December 3, 2017

Linux server manual patching by using yum step by step

Sunday, December 03, 2017 0

Linux server manual patching by using yum  step by step

Follow the below steps to complete the manual patching of Linux server.

$ yum -y update yum >/dev/null 2>&1
$ yum -y update libstdc++ >/dev/null 2>&1
$ yum -y update kernel glibc >/dev/null 2>&1
$ yum -y update >/dev/null 2>&1

>       - redirect
/dev/null -  black hole where any data sent, will be discarded
2    - file descriptor for Standard Error
>    - redirect
&    - symbol for file descriptor (without it, the following 1 would be considered a filename)
1    - file descriptor for Standard Out

So  >/dev/null 2>&1 is redirect the output of your program to /dev/null. Include both the Standard Error and Standard Out. For more info refer Linux I/O redirection.