Cloud Network

Networking | Support | Tricks | Troubleshoot | Tips

Buymecoffe

Buy Me A Coffee
Showing posts with label Redhat Linux. Show all posts
Showing posts with label Redhat Linux. Show all posts

Monday, November 2, 2020

RHEL 7 uses system temp files to

November 02, 2020
RHEL 7 uses system temp files to

 

Managing temporary files with systemd-tmpfiles on Red Hat

Why the files in /tmp directory gets deleted periodically

 

For CentOS/RHEL7

cd /usr/lib/tmpfiles.d/tmp.conf

# cat /usr/lib/tmpfiles.d/tmp.conf
# Clear tmp directories separately, to make them easier to override
v /tmp 1777 root root 10d
v /var/tmp 1777 root root 30d

# Exclude namespace mountpoints created with PrivateTmp=yes
x /tmp/systemd-private-%b-*
X /tmp/systemd-private-%b-*/tmp
x /var/tmp/systemd-private-%b-*
X /var/tmp/systemd-private-%b-*/tmp
 

For CentOS/RHEL6

cd /etc/cron.daily/tmpwatch

# cat /etc/cron.daily/tmpwatch
#! /bin/sh
flags=-umc
/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
	-x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix \
	-X '/tmp/hsperfdata_*' -X '/tmp/.hdb*lock' -X '/tmp/.sapstartsrv*.log' \
	-X '/tmp/pymp-*' 10d /tmp
 
# man tmpwatch 

 

Tuesday, October 29, 2019

How to Install Samba v4.11.1 on a RHEL/CentOS and Fedora

October 29, 2019
How to Install Samba v4.11.1 on a RHEL/CentOS and Fedora
Installing Samba on a Unix System

Directory installed : /etc/samba
Configuration file installed : smb.conf

If Samba is already installed on your system, you can check to see what version you have by using the command:
Step1 :- smbd -V

Version 4.11.1
OR
Step1 :- rpm -qa | grep samba

samba-client-4.11.1-1.7.1

samba-4.11.1-1.7.1

samba-common-4.11.1-1.7.1

How to remove rpm package
Step2 :- rpm -e samba
rpm -e samba-client
rpm -e samba-common

Downloading the Samba
Check Latest Version : http://www.samba.org
Step3 :- samba-latest.tar.gz
or
https://download.samba.org/pub/samba/stable/samba-4.11.1.tar.gz

Step3 :- tar xvfz samba-latest.tar.gz or tar xvfz samb-4.11.1.tar.gz

if you dont have GUN tar then run this
Step3 :- gunzip samba-latest.tar.gz  or gunzip samb-4.11.1.tar.gz

Step3 :- tar xvf samba-latest.tar or tar xvf samb-4.11.1.tar

Step3 :- configure

Step3 :- make

Step3 :- make install


Configuring Samba
Login with root account
./configure

cd samba-2.2.6/source/
su
./configure --with-smbwrapper --with-smbmount \

mkdir /usr/local/samba/tmp

# chmod 777 /usr/local/samba/tmp

To Set Encrypted Password in smb
smbpasswd -a itcloudnet

Access by URL
http://localhost:901















Monday, October 28, 2019

How to Reset/Recover/Forget Root Password in CentOS/RHEL/Fedora and VM/KVM

October 28, 2019
How to Reset/Recover/Forget Root Password in CentOS/RHEL/Fedora and VM/KVM

Note : Take Backup of your data before you proceed

Method 1 - (CentOS/RHEL/Fedora)

Step1 :- Restart the Machine

Step2 :- Press "e" from keyboard at time when kernel versions presented Press "e" again

Step3 :- Search for "rd.break" line (last line of Linux16) or write next to rw file (rw init=/sysroot/bin/sh)

Step4 :- Press Ctrl+X(control+x) to start on single user mode

Step5 :- Type at command line "mount -o remount, rw /sysimage"
chroot /sysimage or  chroot /sysroot
passwd root      or  passwd
load_policy -i   or touch /.autorelabel
restorecon /etc/shadow to restore the SELinux settings for the given file
reboot   or exit

Method 2 - (CentOS/RHEL/Fedora)

Step1 :- Boot/Restart the Virtual Machine or Server

Step2 :- Then Select Troubleshooting see below screenshot

Step3 :- Then Select Rescue a CentOS system and hit Enter

Step4 :- Then type 1 and hit enter a couple of times until you get the command prompt (shell).

Step5 :- Then type in command prompt one by one
Chroot /mnt/sysimage
Passwd
Rm -f /.autorelabel
Exit
Exit

Step6 :- After Reboot Login with New Password

Method 3 - (CentOS/RHEL/Fedora)

Step1 :- Boot/Restart the Virtual Machine or Server

Step2 :- Interrupt while booting at GRUB Stage with any arrow or space bar from keyboard

Step3 :- Type "e" to edit kernel argument, 'ESC' is used for Cancel or to goback

Step4 :- Then type 1 after rhgb quiet line hit enter to boot

Step5 :- Press "b" to boot process then type "runlevel" in command prompt 1S is single user mode

Step6 :- Type New Password and Again Same Password

Step7 :- Reboot it

Wednesday, October 23, 2019

How to Configure Apache HTTP Secure Server

October 23, 2019
How to Configure Apache HTTP Secure Server

How to generate your own self-signed certificate, and How to install a certificate to use with your secure server.






The mod_ssl configuration file is located at /etc/httpd/conf.d/ssl.conf. For this file to be loaded, and hence for mod_ssl to work, you must have the statement Include conf.d/*.conf in /etc/httpd/conf/httpd.conf. This statement is included by default in the default Apache HTTP Server configuration file.

Creating a Self-Signed Certificate

You can create your own self-signed certificate. Note that a self-signed certificate does not provide the security guarantees of a CA-signed certificate.

To make your own self-signed certificate, first create a random key using the instructions provided in Section 27.6 Generating a Key. Once you have a key, make sure you are in the /usr/share/ssl/certs directory, and type the following command:

Step1 :- make testcert

The following output is shown, and you are prompted for your passphrase (unless you generated a key without a passphrase):

umask 77 ; \
/usr/bin/openssl req -new -key /etc/httpd/conf/ssl.key/server.key
-x509 -days 365 -out /etc/httpd/conf/ssl.crt/server.crt
Using configuration from /usr/share/ssl/openssl.cnf
Enter pass phrase:




After you enter your passphrase (or without a prompt if you created a key without a passphrase), you are asked for more information. The computer's output and a set of inputs looks like the following (provide the correct information for your organization and host):

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a
DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:India     
State or Province Name (full name) [Berkshire]:Hyd
Locality Name (eg, city) [Newbury]:Cloud Network
Organization Name (eg, company) [My Company Ltd]:My Company, Inc.
Organizational Unit Name (eg, section) []:IT Networking
Common Name (your name or server's hostname) []:myhost.example.com
Email Address []:myemail@example.com
After you provide the correct information, a self-signed certificate is created in /etc/httpd/conf/ssl.crt/server.crt. Restart the secure server after generating the certificate with following the command:

Step2 :- /sbin/service httpd restart

Generating a Certificate Request to Send to a CA

Once you have created a key, the next step is to generate a certificate request which you need to send to the CA of your choice. Make sure you are in the /usr/share/ssl/certs directory, and type in the following command:

Step3 :- make certreq
Your system displays the following output and asks you for your passphrase (unless you disabled the passphrase option):

umask 77 ; \
/usr/bin/openssl req -new -key /etc/httpd/conf/ssl.key/server.key
-out /etc/httpd/conf/ssl.csr/server.csr
Using configuration from /usr/share/ssl/openssl.cnf
Enter pass phrase:
   
Type in the passphrase that you chose when you were generating your key. Your system displays some instructions and then ask for a series of responses from you. Your inputs are incorporated into the certificate request. The display, with example responses, looks similar to the following:

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a
DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:India
State or Province Name (full name) [Berkshire]:Hyd
Locality Name (eg, city) [Newbury]:Cloud Network
Organization Name (eg, company) [My Company Ltd]:Test Company
Organizational Unit Name (eg, section) []:Testing
Common Name (your name or server's hostname) []:test.example.com
Email Address []:admin@example.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

Ggenerating a Key

You must be root to generate a key.

First, cd to the /etc/httpd/conf/ directory. Remove the fake key and certificate that were generated during the installation with the following commands:


Step4 :- rm ssl.key/server.key
Step5 :- rm ssl.crt/server.crt
Next, you need to create your own random key. Change to the /usr/share/ssl/certs/ directory, and type in the following command:

Step6 :- make genkey
Your system displays a message similar to the following:

umask 77 ; \
/usr/bin/openssl genrsa -des3 1024 > /etc/httpd/conf/ssl.key/server.key
Generating RSA private key, 1024 bit long modulus
.......++++++
................................................................++++++
e is 65537 (0x10001)
Enter pass phrase: