Cloud Network

Networking | Support | Tricks | Troubleshoot | Tips

Buymecoffe

Buy Me A Coffee
Showing posts with label Fedora. Show all posts
Showing posts with label Fedora. 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 

 

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

Tuesday, October 22, 2019

How to Generate/Encrypt/Decrypt Random Passwords on CentOS/RHEL & Fedora

October 22, 2019
How to Generate/Encrypt/Decrypt Random Passwords on CentOS/RHEL & Fedora
 




 1. Generate a random unique password of length equal to 10 characters
Step1 :-  yum install pwgen
Step2 :-  pwgen 10 1
Step3 :-  pwgen 50
Step4 :- yum install expect
Step5 :- yum –y install makepasswd    --- As per choice
Step6 :- makepasswd                       --- Default is 10
Step7 :- makepasswd  --char 50
Step8 :- makepasswd  --char 20  --count 7     --- Generate 7 random password of 20cht.

2. Encrypt a password using crypt along with salt.

Salt is a random data which servers as an additional input to one way function in order to protect password against dictionary attack.




Step9 :-  Yum install mkpasswd
Step10 :- mkpasswd  cloudnetwork
                mkpasswd cloudnetwork  -s   tt

4. Encrypt a string say “cloudnetwork is a video tutorials make in Linux,Ubuntu” using aes-256-cbc encryption using password say “cloudnetwork” and salt.

Step8 :- echo cloudnetwork-is-a-video-tutorials-make-in-Linux,Ubuntu  | openssl
enc -aes-256-cbc -a -salt -pass pass:cloudnetwork

5. Decrypt the above string using openssl command using the -aes-256-cbc decryption.

Step9 :- echo U2FsdGVkX18Zgoc+dfAdpIK58JbcEYFdJBPM9oXWsgpvpdO/Z | openssl
enc -aes-256-cbc -a -d -salt -pass pass:cloudnetwork