Linux

Reset root password in CentOS 7

Posted on

https://www.unixmen.com/reset-root-password-centos-7/ 1 – In the boot grub menu select option to edit. 2 – Select Option to edit (e). 3 – Go to the line of Linux 16 and change ro with rw init=/sysroot/bin/sh. 4 – Now press Control+x to start on single user mode. 5 – Now access the system with this command. chroot […]

Linux

How to create SHA512 password hashes on command line

Posted on

https://unix.stackexchange.com/questions/52108/how-to-create-sha512-password-hashes-on-command-line Python (>= 3.3) $ python -c ‘import crypt,getpass; print(crypt.crypt(getpass.getpass(), crypt.mksalt(crypt.METHOD_SHA512)))’ -or scripted- $ python -c ‘import crypt; print(crypt.crypt(“somesecret”, crypt.mksalt(crypt.METHOD_SHA512)))’ Python (2.x or 3.x) $ python -c “import crypt, getpass, pwd; \ print(crypt.crypt(‘password’, ‘\$6\$saltsalt\$’))” $6$saltsalt$qFmFH.bQmmtXzyBY0s9v7Oicd2z4XSIecDzlB5KiA2/jctKu9YterLp8wwnSq.qc.eoxqOmSuNp2xS0ktL3nh/ Note: $6$ designates sha512. Support for this method of specifying the algorithm is dependent on support in OS level crypt(3) […]

Linux

Installing CentOS

Posted on

Установка CentOS LVM не используем По умолчанию на небольшой диск (< 2TB) Linux пытается установить MBR. Чтобы выбрать EUFI (GPT) либо выбираем ее как основной способ загрузки в BIOS, либо выбираем в качестве первого загрузочного устройства USB-флэшку, с которой проводим инсталляцию, тогда программа установки сама переключится на EUFI. Если используется EUFI, дополнительно к стандартным разделам […]

Linux

Unix monitoring and audit

Posted on

https://cisofy.com/lynis/ Lynis is an open source security auditing tool. Used by system administrators, security professionals, and auditors, to evaluate the security defenses of their Linux and Unix-based systems. It runs on the host itself, so it performs more extensive security scans than vulnerability scanners. It is also the client in our Lynis Enterprise offering. https://www.tecmint.com/linux-server-health-monitoring-script/  

Linux

Linux multihome host with rule based routing

Posted on

http://jensd.be/468/linux/two-network-cards-rp_filter rp_filter Since RHEL 6 (and CentOS 6), asymmetric routing doesn’t work anymore out of the box. The cause of the issue is a change in the default value for kernel parameter rp_filter. Rp_filter stands for reverse path filtering. The reverse path filter will check if the source of a packet that was received on a certain interface […]

Linux

Working with local sendmail queue

Posted on

https://www.cyberciti.biz/tips/howto-postfix-flush-mail-queue.html Under Postfix MTA, just enter the following command to flush the mail queue: # postfix flush OR # postfix -f To see mail queue, enter: # mailq OR #  sendmail -bp To remove all mail from the queue, enter: # postsuper -d ALL To remove all mails in the deferred queue, enter: # postsuper […]

Linux

InitV and systemd parctical notes

Posted on

Nicely written reference https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-Managing_Services_with_systemd-Unit_Files.html Short cheat shit List services: # chkconfig –list # systemctl list-units This will show any unit that systemd loaded or attempted to load, regardless of its current state on the system. # systemctl list-units –all # systemctl list-units –all –state=inactive # systemctl list-units –type=service Since systemd will only read units that it […]

Linux

Sudoers syntax

Posted on

http://unix.stackexchange.com/questions/18877/what-is-the-proper-sudoers-syntax-to-add-a-user In the following sudo entry: superadm ALL=(ALL) ALL there are four fields: The first one specifies a user that will be granted privileges for some command(s). The second one is rarely used. It’s a list of hostnames on which this sudo entry will be effective. On standard setups only one host is relevant (localhost) […]

Linux

vmstat output explained

Posted on

Table 11-4 Output From the vmstat Command Category Field Name Description procs Reports on the following: r The number of kernel threads in the dispatch queue b The number of blocked kernel threads that are waiting for resources w The number of swapped out LWPs that are waiting for processing resources to finish memory Reports on usage of […]

Linux

Parallel and xargs commands

Posted on

1. Decypher gpg files find ./ -name “*.gpg” |  while read OUT; do echo ${OUT%.*}; done | /usr/local/bin/parallel -P 15 gpg –output {}  –decrypt {}.gpg 2. Unzip files find ./ -name “*.gz” |  /usr/local/bin/parallel -P 15 gunzip {} \; unzip into different directory: find ./ -name “*.gz” | while read OUT; do echo ${OUT%.*}; done […]