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

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.

Friday, December 1, 2017

SSH Key Gen & SSH Keys on windows system to Linux Server

Friday, December 01, 2017 0

SSH Key Gen & SSH Keys on windows system to Linux Server 

NAME
     ssh-keygen - authentication key generation, management and conversion


ssh-keygen generates, manages and converts authentication keys for ssh.  ssh-keygen can create RSA keys for use by SSH protocol version 1 and DSA, ECDSA or RSA keys for use by SSH protocol version 2. 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.

SSH Key Generation:

[nsk@nsk-linux ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/nsk/.ssh/id_rsa):      - Just give enter
Enter passphrase (empty for no passphrase):                           - Dont give passphrase
Enter same passphrase again:               
Your identification has been saved in /home/nsk/.ssh/id_rsa.
Your public key has been saved in /home/nsk/.ssh/id_rsa.pub.
The key fingerprint is:
ae:67:71:78:9e:b5:31:1e:bb:7b:c7:0a:3b:18:0b:c8 nsk@nsk-linux
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|                 |
|                 |
|     . .S.       |
|      E.+ + =    |
|        .* B.* . |
|       .o = =o. o|
|      .o    +=.o |
+-----------------+

[nsk@nsk-linux ~]$ cd .ssh/
[nsk@nsk-linux .ssh]$ ls -al
total 48
drwx------  2  nsk  nsk  4096 Dec  1  10:08 .
drwx------ 37 nsk  nsk  4096 Nov 26 09:51 ..
-rw-------  1   nsk  nsk  1675 Dec  1  10:08 id_rsa
-rw-r--r--  1   nsk  nsk   395 Dec  1   10:08 id_rsa.pub
-rw-------  1   nsk  nsk  8594 Nov  7   08:23 known_hosts


We need to convert id_rsa key (windows to linux) for successful password less authentication from windows system

1. Save the id_rsa key in Windows system
2. Use Putty Key Generator tool & click the conversions
3. Click Import Key & Browse the id_rsa key
                                      click_conversion_select_key
Once_loaded_click_save_private_key_popup_yes
4. Click Save Private Key. Once pop up comes, click save the key without a passphrase on local system.
save_key_in_local_system

5. Copy  id_rsa.pub key to /home/nsk/.ssh/authorized_keys  (change the user home directory)
[nsk@nsk-linux .ssh]$ cat id_rsa.pub >> /home/nsk/.ssh/authorized_keys
[nsk@nsk-linux .ssh]$ cat authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAv4ZERTCXFpGZLrNKBOQfiTE5SEQYvtiolNt8KnMVY9bxwEUMyPUX9EwmJxW51BY8I9Xq6VGoU2nskS0GrTgqjAOeptTRia0ws7inkc9oHVHryqJdgvhYvpVj2lLsnRTO9Lv4P6Pkycvg5xioAKRTdL8EffPxWtu8x1iL6aYsHThxsrpmXzK0LrkHLnGsJT5nRtNOWlUJW9npNPRBSqRmPjFCRpWb2kgn7MUKJnr5rXA2kgrULCvx97EFDxA/HYAxFgld7yGdnPjdZWyrkXK/FsFmsU4xoGoSNVKG1Vq1R18rc/cNjtVPME9TBxD8OBB8FQYiyHLYWLF+x9EbGsY+lQ== nsk@nsk-linux


6.  Here .ssh should be 0700 permission and authorized_keys should be 0600 permisssion.


7.  Open putty tool - Enter the Server IP in session ==> expand the SSH ==> select AUTH and browse the key ==> Select the key


session_ip_ssh_AUTH_select_key
8. Give username & enter. Here Putty session wont ask password.
ssh_with_key_authentication


Hope it helps.

Could not load XPCOM Solved

Friday, December 01, 2017 0
Mozilla Firefox error : Couldn't load XPCOM  while loading.




Cause - C drive space got filled. So there is no space for exploring the firefox

Solution : Remove the unwanted files & clear the Temp folder.

Monday, November 27, 2017

Integrated Lights Out Manager ILOM Command line Linvirtshell

Monday, November 27, 2017 0

Integrated Lights Out Manager ILOM Command line

Login with ILOM root password
[root@testserver ~]# ssh test-ilom.example.com
Oracle(R) Integrated Lights Out Manager
Version 3.2.8.25 r114493
Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
Warning: HTTPS certificate is set to factory default.
Hostname: test-ilom

Below targets are available to check in console. Once you run ls command, will get the property information of hardware. In that property we can get ILOM IP address, MAC ID, Server Model, Serial No & Operating system detail as well.

-> ls

 /System
    Targets:
        Open_Problems (0)
        Processors
        Memory
        Power
        Cooling
        Storage
        Networking
        PCI_Devices
        Firmware
        BIOS
        Log
    Properties:
        health = OK
        health_details = -
        open_problems_count = 0
        type = Rack Mount
        system_fw_version = 3.2.8.25
        locator_indicator = Off
        power_state = On
        actual_power_consumption = 305 watts
        action = (none)

a. To check power supply status
-> cd /System/power
/System/Power

-> show

 /System/Power
    Targets:
        Power_Supplies

    Properties:
        health = OK
        health_details = -
        actual_power_consumption = 383 watts
        max_permitted_power = 788 watts
        installed_power_supplies = 2
        max_power_supplies = 2

->
Login as root & run ipmitool command.
[root@test-ilom~]# ipmitool sunoem cli
Connected. Use ^D to exit.
-> show -l all /System/Power/Power_Supplies location health -t
Target             | Property              | Value
-------------------+-----------------------+-----------------------------------
/System/Power/     | health                | OK
Power_Supplies/   |                       |
Power_Supply_0   |                       |
/System/Power/     | location              | PS0 (Power Supply 0)
Power_Supplies/   |                       |
Power_Supply_0   |                       |
/System/Power/     | health                | OK
Power_Supplies/   |                       |
Power_Supply_1   |                       |
/System/Power/     | location              | PS1 (Power Supply 1)
Power_Supplies/   |                       |
Power_Supply_1   |                       

b. To check Processors status
-> cd Processors
/System/Processors

-> show

 /System/Processors
    Targets:
        CPUs

    Properties:
        health = OK
        health_details = -
        architecture = x86 64-bit
        summary_description = Two Intel Xeon Processor E5 Series
        installed_cpus = 2
        max_cpus = 2

c. To check BIOS version
-> cd BIOS
/System/BIOS

-> show

 /System/BIOS
    Targets:
        Config

    Properties:
        system_bios_version = 17120100
        boot_mode = Legacy
        reset_to_defaults = none

Sunday, November 26, 2017

Ignore first 4 lines of cat command output and display first word of remaining lines Unix

Sunday, November 26, 2017 0

Below awk command is very useful to run small scripts in Unix.

Ignore first 4 lines of cat command output and display first word of remaining lines  Unix

Purpose Ignore first 4 lines of cat command output and display first word of remaining lines.

[root@nsk-linux tmp]# cat test.txt
Public cloud is future
Automation never ends
Infra as a Service
Private Cloud
Baremetal Cloud Service
Amazon Cloud service

[root@nsk-linux tmp]# cat test.txt |  awk '{if(NR>4)print $1}'
Baremetal
Amazon

Here, as per our need we can change the value.

Saturday, November 25, 2017

Virtual machines show warning messages when starting the udev daemon Linux

Saturday, November 25, 2017 0

Virtual machines show warning messages when starting the udev daemon.

After upgrading VMware Tools,  Linux virtual machines show warnings when starting the udev daemon.

dmesg shows the below messages.

Starting udev:
udevd[572]: add_to_rules: unknown key 'SUBSYSTEMS'
udevd[572]: add_to_rules: unknown key 'ATTRS{vendor}'
udevd[572]: add_to_rules: unknown key 'ATTRS{model}'
udevd[572]: add_to_rules: unknown key 'SUBSYSTEMS'
udevd[572]: add_to_rules: unknown key 'ATTRS{vendor}'
udevd[572]: add_to_rules: unknown key 'ATTRS{model}'

Ctrl+C will bypass udev daemon to finish the boot process.

To disable the warning message, comment out unused lines (ubuntu  & other type of unix entries) in the  /etc/udev/rules.d/99-vmware-scsi-udev.rule file

For linux we need to modify the below line from

ACTION=="add", BUS=="scsi", SYSFS{vendor}=="VMware, " , SYSFS{model}=="VMware Virtual S", RUN+="/bin/sh -c 'echo 180 >/sys$DEVPATH/device/timeout'"

To

ACTION=="add", BUS=="scsi", SYSFS{vendor}=="VMware " , SYSFS{model}=="Virtual disk ", RUN+="/bin/sh -c 'echo 180 >/sys$DEVPATH/device/timeout'"

Save the modifiation and reboot the virtual machine.