Tuesday, July 20, 2021

Disable "your organization requires you to change your password" in Windows 10

 This might not be part of the open source, but its just a thing to blog.

Recently a windows 10 Home, login screen after successfully entering the PIN popup the message "your organization requires you to change your password" and forced users to change the pin before proceeding. Those who were not aware, changed it, but did not remember this new PIN the next time they needed to login.

I am trying out this method, but can't say it works as I have not done more test. Its just for my record


Steps

In Windows 10, press Win+r and type regedit

Scroll through Registry Editor, explorer like navigation as follow

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Policies\PassportForWork

Look for the item within that sub-folder named Policies\PINComplexity where it contain several value. Change the value named "Expiration". Double click and choose decimal. In Value data put in the number of days before the PIN expires. 

I can't say whats the correct value to disable, but for now I am using the Value data=600 (in decimal). Expecting the PIN to last 600 days. Maybe Windows 11 would be out by then.


Monday, July 12, 2021

KVM virtual machine on Centos 8 - Change name and Create snapshots

 Virtualisation provide a more efficient use of memory, disk and all CPU on a server. Separate servers can be managed within a single server. Centos 8 provide virtual machine (VM) management through KVM (kernel virtual machine).

 Each VM is given a domain name. Common practice before upgrading a server operating system, is to create a backup the current VM, or as its known here, a snapshot. Default format in use is qcow2, where tools for snapshot will work. Through Virtual Machine Manager and Cockpit, virtual machines can be created and managed. 

Centos 8 Cockpit view of VM administration

 Creating of virtual machines is not covered in here as its quite straight forward. Mostly it depends on the organisation practise and best practises.

Pre-requisite:
  • Centos 8 is installed with virtual machine manager.
  • A virtual machine is already added with the name "Centos7_php"

 Let's work with an existing VM named "Centos7_php". This virtual machine is installed with the operating system Centos Linux 8 and all the other packages required as a PHP development server. This requires the VM to be shutdown (and there are no snapshots)

Display available running VM

Syntax: 

virsh list


Shutdown VM

Syntax:
virsh shutdown {domain}
virsh shutdown Centos7_php

Rename VM

Syntax: 
virsh domrename {domain} {new_name}

virsh domrename Centos7_php php_development

Startup VM

Note: The following will continue to use the initial VM name of Centos7_php.

Syntax: 
virsh start {domain}

virsh start Centos7_php

Retrieve VM configuration

Syntax: 
virsh dumpxml {domain}

List available snapshots for a domain

Syntax:
virsh snapshot-list --domain {domain}

Create a snapshot

Snapshots can be created while a VM is running. Best practise would be to stop the VM, where possible. The reason why double-quotes are used here, is that its common to have snapshot name with spaces. But no so for the domain name.
Syntax:
virsh snapshot-create-as --domain {domain} --name "{snapshot_name}"


View details of a snapshot with syntax:
virsh snapshot-info --domain {domain} --name "{snapshot_name}"

Example of creating a snapshot, then showing its details

virsh snapshot-create-as --domain Centos7_php \ 
  --name "2021July" --description "Snapshot initial stages"
virsh snapshot-list --domain Centos7_php
virsh snapshot-info --domain Centos7_php --name "2021July" 

Revert to a specific snapshot

Ensure the VM is shutdown before switching to a snapshot. Here is the syntax and an example.
Syntax:
virsh --snapshot-revert --domain {domain} --snapshotname "{snapshot_name}"

Example to switch to a snapshot known and initial.

virsh shutdown Centos7_php
virsh --snapshot-revert --domain Centos7_php \
     --snapshotname "2021July"
virsh start Centos7_php 

Delete a snapshot

Each snapshot takes up disk space, and these can be removed when not in use anymore.

Syntax:
virsh --snapshot-delete --domain {domain} --snapshotname "{snapshot_name}"

Example to delete a snapshot

virsh --snapshot-delete --domain Centos7_php --snapshotname "2021July" 


Saturday, July 3, 2021

Howto check Centos 7 and 8 common services

In Centos 7 and earlier, SysV manage Linux services. To list such services, 

config --list


Centos 7 and 8 uses Systemd to manage Linux services. The syntax for this command is

systemctl [OPTIONS...] COMMAND [UNIT...]

Centos 7 was a transition phase towards the newer Systemd, and it maintained a mix of service types.


Here are a list of common command to check Linux services.

List active systemd services

systemctl 



List all systemd services

systemctl -a

List only SysV services (centos 7 and older)

systemctl list-unit-files


List by service types

systemctl list-units --type service

systemctl list-units --type mount

Where

LOAD   = Reflects whether the unit definition was properly loaded.

ACTIVE = The high-level unit activation state, i.e. generalization of SUB.

SUB    = The low-level unit activation state, values depend on unit type.


Check status of a service

systemctl status sshd.service

sudo systemctl status nfs-server.service


To stop or start or restart a service

sudo systemctl stop nfs-server.service

sudo systemctl start nfs-server.service

sudo systemctl restart nfs-server.service


To determine service is active or enabled the following will return 0 (active) and non zero (disabled)

systemctl is-active sshd

systemctl is-enabled sshd

systemctl is-active nfs-server

systemctl is-enabled nfs-server


To list a service and its dependencies;

 systemctl list-dependencies nfs-server


List services and their number of running task, CPU percentage, memory usage and I/O continuously

systemd-cgtop


List services as above once

systemd-cgtop -n 1


To sort, use the following based on the column titles

systemd-cgtop -t 

systemd-cgtop -c

systemd-cgtop -m

systemd-cgtop -i


List services and their open ports

netstat -a

List services that use TCP and UDP and their open ports

netstat -tulpn


Display which user is used for a filename

fuser . -v


Display running service

top


Display running services in pretty formatting and enable F1-F10 commands.

htop






Blog Archive