Friday, January 25, 2019

lsb_release package install with script.

[root@desk-03 tmp]# cat lsb_pkginstall.sh

#!/bin/bash

FILENAME=/usr/bin/lsb_release

if [ ! -f  $FILENAME ]

then

echo "Installing lsb_release on the system please wait....."

yum repolist > /dev/null 2>&1  ; sleep 3 ;  yum -y install redhat-lsb-core > /dev/null 2>&1

echo `ls -l /usr/bin/lsb_release`

else

echo "lsb_release command exists nothing changed"

fi


Happy Scripting!


Disclaimer: This is for my reference only - Use at your own discretion.

Use RDP to connect to CentOS 7 GUI.

Follow below steps to get this going...


#  rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
# rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
# yum -y install xrdp tigervnc-server
# systemctl start xrdp.service
# ifconfig
# systemctl status firewalld
#  firewall-cmd –permanent –zone=public –add-port=3389/tcp
# firewall-cmd --add-port=3389/tcp --permanent
# firewall-cmd --reload
# firewall-cmd --list-all

[Next]

Open Remote desktop - punch in IP/Hostname and enter user/password once prompted.



Disclaimer: This is for my reference so use at your own discreet.

Happy Linux!


CentOS7 GUI installation.

To access desktop in CentOS7: As root

  • Make sure yum repository is active and running
# yum repolist
 
# yum groupinstall "Server with GUI"

 # systemctl isolate graphical.target

 # systemctl set-default graphical.target

 # systemctl get-default

 # graphical.target . --> 

You should see this after reboot or not required in some cases. Mine got switched to GUI without reboot so looks like the above command takes care of that and not like old times.



Happy Linux!




Friday, January 11, 2019

Few Linux System Administrator "One Liners"


Some common frequently needed commands:


  • Change the hostname everywhere in CentOS/RHEL7:

# hostnamectl --static set-hostname idm-auth-admin-lkf-noc03

# systemctl restart systemd-hostnamed

  • To update the ntpd with the timeserver:
# ntpdate -u  time_server_ip

# ntpq -np

  • RHEL7 client registration with RHN network.
# subscription-manager register --username --password  secret --auto-attach

  • DNS record queries - forward and reverse

DNS records quarry for Linux host:

[root@idm ~]# dig +short idm.lab.example.com A
172.25.250.8

[root@idm ~]# dig +short -x 172.25.250.8
idm.lab.example.com.

grep -w(hostname) /etc/hosts




How to create IPA External and IPA POSIX Groups.

Creating RHEL7 IdM Groups for Active directory users :

This is a four step process after the AD external trust is established with the RHEL7 IdM. Which is Authentication part where you can login as an AD user via IdM to the Linux clients/hosts. But to get authorized to be able to execute root level command and to be a root user. Where access like -
"sudo su -" is required as a Linux Administrator.


  • # ipa group-add --desc='AD users external map' ad_users_external --external
  • # ipa group-add --desc='AD users' ad_users
  • # ipa group-add-member ad_users_external --external "AD_DOMAIN\Administrator"
  • # ipa group-add-member ad_users --groups ad_users_external

Happy Linux!

ipa-client-install --enable-dns-updates --domain domain_name fails with LDAP Connect Error.

LDAP Error: Connect error: Start TLS request accepted.Server willing to negotiate SSL

During reinstalling the spa client as a part of migrating the host/client from Free IPA to RHEL7 IdM
Client is - CentOS 6.6
IdM is - FreeIPA, version: 4.6.4

Cause of the issue: Looks like this is a bug.

Details:

The host had old ldap configuration and old /etc/ipa/ca.crt  was forcing ipa-client-install script to use cert as there was remnant configuration hanging around. But after running below command  the spa client install went fine.

mv /etc/ipa/ca.crt /etc/ipa/ca.crt.Orig

As per RHEL7 - ipa-client-install --uninstall do not remove DNS entries from IPA server.

But in this case this was not applicable as the issue was totally client side one as it was using openldap server for authentication and authorization!

[root@idm-client ~]# ipa-client-install --enable-dns-updates --domain
Discovery was successful!

Happy Linux!


Monday, July 23, 2018

Put existing running process in background on Linux

In case you need to put existing running process on the current shell in the background for some reason. Please apply following steps:

example:

# echo "Hello World" ; sleep 100
# run ctrl z keyboard keys together
# bg
# disown -h
# exit

Explanation: Ctrl z will pause the program and will bring you back to the shell, bg command will put the process in background and disown -h will make sure that the process is not killed when you exit the terminal. exit is pretty much self explanatory.