Tuesday, May 23, 2023

How to setup SSH Passwordless Login in Linux ?

 Setup SSH Passwordless Login in Linux for oracle user 


Source server : 10.1.1.1

Target server : 10.1.1.2


Genrate SSH key pair 


[oracle@10.1.1.1]$ ssh-keygen

Generating public/private rsa key pair.

Enter file in which to save the key (/home/oracle/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/oracle/.ssh/id_rsa.

Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.

The key fingerprint is:

SHA256:CQIzV4K1UyZ/7WmRtLTyPb1N3EHRXoZj4W09bbcQtDk oracle@ip-10.1.1.1.ec2.internal

The key's randomart image is:

+---[RSA 3072]----+

|  +o=.+   o .o.=o|

|  .= B   + + .O.*|

|    + o o *  E.*O|

|     o o = + .o+B|

|        S = o ..+|

|         .   . + |

|              . .|

|                 |

|                 |

+----[SHA256]-----+

[oracle@10.1.1.1]$

[oracle@10.1.1.1]$

[oracle@10.1.1.1]$


Upload SSH Key to target server – 10.1.1.2


ssh-copy-id oracle@10.1.1.2



[oracle@10.1.1.1]$

[oracle@10.1.1.1]$ ssh-copy-id oracle@10.1.1.2

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/oracle/.ssh/id_rsa.pub"

The authenticity of host '172.31.21.233 (172.31.21.233)' can't be established.

ECDSA key fingerprint is SHA256:0cU9N1c6iec4IMkhQeT8s7FmzF04X0iLy8pytlr1JCk.

Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys

oracle@172.31.21.233's password:


Number of key(s) added: 1


Now try logging into the machine, with:   "ssh 'oracle@10.1.1.2"

and check to make sure that only the key(s) you wanted were added.


[oracle@10.1.1.1]$

[oracle@10.1.1.1]$



Test and validate passwordless login 


Option:1


[oracle@10.1.1.1]$

[oracle@10.1.1.1]$

[oracle@10.1.1.1]$ ssh oracle@10.1.1.2

Register this system with Red Hat Insights: insights-client --register

Create an account or view all your systems at https://red.ht/insights-dashboard

Last login: Tue May 23 16:57:35 2023

[oracle@10.1.1.2 ~]$

[oracle@10.1.1.2 ~]$




Option:2

[oracle@10.1.1.1]$ ssh -l oracle 10.1.1.2

Register this system with Red Hat Insights: insights-client --register

Create an account or view all your systems at https://red.ht/insights-dashboard

Last login: Tue May 23 17:06:21 2023 from 10.1.1.1

[oracle@10.1.1.2]$


How to Set Timezone Using timedatectl Command in Linux ?

 Set Timezone Using timedatectl Command in Linux




Check current time and timezone details :


option:1

[root@0.0.0.0]#

[root@0.0.0.0]#

[root@0.0.0.0]#

[root@0.0.0.0]# timedatectl status

               Local time: Tue 2023-05-23 13:53:08 UTC

           Universal time: Tue 2023-05-23 13:53:08 UTC

                 RTC time: Tue 2023-05-23 13:53:09

                Time zone: UTC (UTC, +0000)

System clock synchronized: yes

              NTP service: active

          RTC in local TZ: no

[root@0.0.0.0]#

[root@0.0.0.0]#


Option:2 



[root@0.0.0.0]#

[root@0.0.0.0]# timedatectl

               Local time: Tue 2023-05-23 13:57:09 UTC

           Universal time: Tue 2023-05-23 13:57:09 UTC

                 RTC time: Tue 2023-05-23 13:57:10

                Time zone: UTC (UTC, +0000)

System clock synchronized: yes

              NTP service: active

          RTC in local TZ: no

[root@0.0.0.0]#






Get Timezone name using timedatectl:




[root@0.0.0.0]#

[root@0.0.0.0]#  timedatectl list-timezones | grep -i kolkata

Asia/Kolkata

[root@0.0.0.0]#






Set timezone using timedatectl command :


[root@0.0.0.0]#

[root@0.0.0.0]#

[root@0.0.0.0]# timedatectl set-timezone "Asia/Kolkata"

[root@0.0.0.0]#




Validate time and timezone 


[root@0.0.0.0]#

[root@0.0.0.0]# timedatectl

               Local time: Tue 2023-05-23 19:28:34 IST

           Universal time: Tue 2023-05-23 13:58:34 UTC

                 RTC time: Tue 2023-05-23 13:58:35

                Time zone: Asia/Kolkata (IST, +0530)

System clock synchronized: yes

              NTP service: active

          RTC in local TZ: no

[root@0.0.0.0]#

[root@0.0.0.0]#


Monday, May 22, 2023

Error : -bash: ifconfig: command not found

 Error :  -bash: ifconfig: command not found  


Login as root user :


[root@0.0.0.0]#

[root@0.0.0.0]#

[root@0.0.0.0]#

[root@0.0.0.0]# ifconfig

-bash: ifconfig: command not found

[root@0.0.0.0]#

[root@0.0.0.0]#

[root@0.0.0.0]#


Install net-tools package using yum command 


[root@0.0.0.0]# yum install net-tools

Updating Subscription Management repositories.

Unable to read consumer identity


This system is not registered with an entitlement server. You can use subscription-manager to register.


Last metadata expiration check: 0:01:33 ago on Mon 22 May 2023 04:36:53 PM UTC.

Dependencies resolved.

==============================================================================================================================

 Package                Architecture        Version                                Repository                            Size

==============================================================================================================================

Installing:

 net-tools              x86_64              2.0-0.52.20160912git.el8               rhel-8-baseos-rhui-rpms              322 k


Transaction Summary

==============================================================================================================================

Install  1 Package


Total download size: 322 k

Installed size: 942 k

Is this ok [y/N]: y

Downloading Packages:

net-tools-2.0-0.52.20160912git.el8.x86_64.rpm                                                 9.4 MB/s | 322 kB     00:00

------------------------------------------------------------------------------------------------------------------------------

Total                                                                                         6.1 MB/s | 322 kB     00:00

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Preparing        :                                                                                                      1/1

  Installing       : net-tools-2.0-0.52.20160912git.el8.x86_64                                                            1/1

  Running scriptlet: net-tools-2.0-0.52.20160912git.el8.x86_64                                                            1/1

  Verifying        : net-tools-2.0-0.52.20160912git.el8.x86_64                                                            1/1

Installed products updated.


Installed:

  net-tools-2.0-0.52.20160912git.el8.x86_64


Complete!

[root@0.0.0.0]#

[root@0.0.0.0]#

[root@0.0.0.0]# ifconfig

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9001

        inet 172.21.31.211  netmask 255.255.240.0  broadcast 172.31.31.255

        inet6 f80::6:3ccf:fe7d:1a13  prefixlen 64  scopeid 0x20<link>

        ether 0a:76:33:7d:1a:13  txqueuelen 1000  (Ethernet)

        RX packets 86484  bytes 127950677 (122.0 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 11182  bytes 1084233 (1.0 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 1000  (Local Loopback)

        RX packets 509  bytes 77514 (75.6 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 509  bytes 77514 (75.6 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


[root@0.0.0.0]#

[root@0.0.0.0]#


How to download file using wget and curl command in linux ?

Download file using wget and curl command in linux 




[root@0.0.0.0 ~]# rpm -qa | grep -i wget

wget-1.19.5-11.el8.x86_64

[root@0.0.0.0 ~]#


Using wget commnad :


[root@0.0.0.0 ~]#

[root@0.0.0.0 ~]# wget https://the.earth.li/~sgtatham/putty/latest/putty-0.78.tar.gz

--2023-05-22 15:44:09--  https://the.earth.li/~sgtatham/putty/latest/putty-0.78.tar.gz

Resolving the.earth.li (the.earth.li)... 93.93.131.124, 2a00:1098:86:4d:c0ff:ee:15:900d

Connecting to the.earth.li (the.earth.li)|93.93.131.124|:443... connected.

HTTP request sent, awaiting response... 302 Found

Location: https://the.earth.li/~sgtatham/putty/0.78/putty-0.78.tar.gz [following]

--2023-05-22 15:44:10--  https://the.earth.li/~sgtatham/putty/0.78/putty-0.78.tar.gz

Reusing existing connection to the.earth.li:443.

HTTP request sent, awaiting response... 200 OK

Length: 2811628 (2.7M) [application/x-gzip]

Saving to: ‘putty-0.78.tar.gz’


putty-0.78.tar.gz               100%[=====================================================>]   2.68M  4.71MB/s    in 0.6s


2023-05-22 15:44:10 (4.71 MB/s) - ‘putty-0.78.tar.gz’ saved [2811628/2811628]


[root@0.0.0.0 ~]#



Using curl command :


[root@0.0.0.0 tmp]# curl -O https://the.earth.li/~sgtatham/putty/latest/putty-0.78.tar.gz

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100   306  100   306    0     0   1066      0 --:--:-- --:--:-- --:--:--  1066

[root@0.0.0.0 tmp]#

[root@0.0.0.0 tmp]#


Friday, May 19, 2023

How to check User Shell details ?

 Check User Shell details  :



[root@0.0.0.0]# cat /etc/passwd

root:x:0:0:root:/root:/bin/bash


[root@0.0.0.0]# echo $0

-bash

[root@0.0.0.0]#


How to check available shell in Linux OS ?

 Check available shell in Linux OS : 


[root@0.0.0.0]# cat /etc/shells

/bin/sh

/bin/bash

/usr/bin/sh

/usr/bin/bash

/bin/ksh

/bin/rksh

/usr/bin/ksh

/usr/bin/rksh

[root@0.0.0.0]#

How to know Linux OS is 64 bit or 32 bit ?

 How to know Linux OS is 64 bit or 32 bit  ?


First Method :

[root@0.0.0.0]#

[root@0.0.0.0]# which arch

/usr/bin/arch

[root@0.0.0.0]#

[root@0.0.0.0]#

[root@0.0.0.0]#

[root@0.0.0.0]# arch

x86_64

[root@0.0.0.0]#

[root@0.0.0.0]#

[root@0.0.0.0]#



Second Method :


[root@0.0.0.0]# uname -a

Linux ip-172-31-19-40.ec2.internal 4.18.0-425.19.2.el8_7.x86_64 #1 SMP Fri Mar 17 01:52:38 EDT 2023 x86_64 x86_64 x86_64 GNU/Linux

[root@0.0.0.0]#


This is 64 bit Operating System because of output is x86_64

Oracle 26 ai database free

 https://www.oracle.com/in/database/26ai/ Oracle 26 ai release  Oracle AI Database Free Want to get hands-on with Oracle AI Database 26ai—ab...