Wednesday, August 31, 2022

Webmin: A web-based Linux management tool

 

Installing Webmin in Redhat 7


If you're a purist, you can download the tarball from webmin.com, but doing so doesn't give you that much extra control over options. You can choose where to place a few files, but save yourself the effort on RHEL, CentOS, and Fedora by installing the RPM:

$ wget https://www.webmin.com/download/rpm/webmin-current.rpm

$ sudo rpm -Uvh webmin-1.XXX-x.noarch.rpm

If your system doesn't have Perl, then you'll have to satisfy that dependency before installing Webmin. You might also have to install the Encode::Detect and Net::SSLeay Perl modules before installing Webmin:

$ sudo yum install perl-Encode-Detect -y

$ sudo yum install perl-Net-SSLeay -y

Once installed, the installation script directs you to your new Webmin instance at http://<servername>:10000. Log in with your system's root password.

You can change the port, username, and password on the Webmin Configuration option (discussed later). Please do make these changes to the username and password.

Navigating Webmin

Webmin, by default, starts you out with the so-called "Authentic" theme, with the navigation frame on the left side of the page:  

Image
Webmin main page showing the Dashboard and Navigation pane.

I much prefer the "Old Webmin Theme," but switching to it breaks the current version, which is 1.920 as of this writing.

Webmin not only provides system administrators with an abundant list of management tools, but it also comes with its own internal configuration and management options:

Image
Webmin's internal configuration menu.

Selecting one of these links opens a number of editable options. For example, below I selected the Webmin Configuration option. As you can see, there are several Webmin behavioral and configuration options available:

Image
Webmin configuration options.

Rather than showing screenshots of every selection from Webmin, I'll let you discover them on your own, but there is one worth taking a closer look at for this overview: Others. Believe it or not, this group of applets is one that I spend a lot of time in. Below, I've selected File Manager from the list to illustrate the depth and richness of these utilities. The volunteer developers have done an excellent job in creating tools that are useful to busy system administrators:

Image
The Webmin Others page's Graphical File Manager tool.

Other notable applets on the Others page are Command ShellPerl ModulesSystem and Server StatusText Login, and Upload and Download. The Command Shell option appears as a root login prompt in the upper left of your screen when selected, containing an interactive shell and not a single command at a time service.

With Perl Modules, you can install Perl modules from CPAN from multiple sources: CPAN itself, local files, URLs, and uploaded files. You can also see a list of your currently installed modules, and optionally install a list of suggested modules with a single click.

The System and Server page provides you with a snapshot of the current status of installed services. There is a drop-down from which you can select a new service to monitor on this screen.

Text Login is a valuable option that provides you with an interactive console terminal login screen. You must have Python installed for this feature to function properly. Also, you might have to create a symbolic link from python to your python executable because the configuration looks for python rather than python2. This is what I did:

$ sudo ln -s /usr/bin/python2 /usr/bin/python

This command satisfies the dependency for the applet.

Finally, the Upload and Download page is valuable for remote uploading and downloading files without access to a secure FTP (SFTP) or secure copy (SCP) client. 

NOTE: If you use Webmin with a Linux server that can be accessed from the internet, please protect this powerful resource by enabling SSL on the Webmin Configuration page, and also enabling multi-factor authentication if possible.


Source: https://www.redhat.com/sysadmin/webmin

 Source: https://www.redhat.com/sysadmin/favorite-linux-sysadmin-tools

Thursday, March 17, 2022

Ubuntu: Extend your default LVM space

 

Linux LVM Briefly Explained

If you followed the default settings in the Ubuntu installation, then the storage for your Linux OS is probably using the Logical Volume Manager (LVM). LVM is an abstraction framework which exists between your physical (or virtual) disks and your Linux file system (which is likely ext4). It is used to group separate block devices (partitions) together into Volume Groups (VGs), and then chop those VGs up into logical block devices, or Logical Volumes (LVs). LV’s are the abstracted block devices upon which your usable file system resides.

Below is good visualization of how LVM works. In this example, we have 5 different disks, each with a single partition mapped to Physical Volumes (PVs), all being grouped into a single Volume Group (VG). The Volume Group is chopped up into two different Logical Volumes (LVs) and each LV is being used for a filesystem.

 

Using a similar visualization, the below diagram shows how the Ubuntu installer (using all default options) divided up my 100GB disk.

 

Ubuntu Installer Default Settings

When installing Ubuntu, it has you approve a storage layout in a couple different screens (shown below). By default this storage layout will have a couple small boot partitions, and a third partition, which will be used by your LVM to create your root filesystem. You should be able to see the consistency between the screens below and the diagram above.

 

Use Your Default Free Space

As you can see above: the Ubuntu installer (by default) left almost half of my disk space unusable by the root file system! I’ve looked around to find an explanation on why these are the default settings, but can’t find anything. Before extending your underlying hypervisor disk or storage volume, you may want to see if you have free space available and ready to be used to extend your existing file system. If you used the Ubuntu defaults during installation, then there is a good chance you have this free space.

Start by checking your root filesystem free space with df -h. As you can see I am only using 14% of my ~49GB volume, but we’ll pretend I’m close to 100% and need to make that 49GB volume larger.

To check for existing free space on your Volume Group (where it is left by the installer default settings), run the command vgdisplay and check for free space. Here you can see I have 49.25GB of free space ready to be used. If you don’t have any free space, move on to the next section to use some free space from an extended physical (or virtual) disk.

To use up that free space on your Volume Group (VG) for your root Logical Volume (LV), first run the lvdisplay command and check the Logical Volume size, then run lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv to extend the LV to the maximum size usable, then run lvdisplay one more time to make sure it changed.

At this point you have increased the size of the block volume where your root filesystem resides, but you still need to extend the filesystem on top of it. First, run df -h to verify your (almost full) root file system, then run resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv to extend your filesystem, and run df -h one more time to make sure you’re successful.

And that’s it. You just allocated the free space left behind by the Ubuntu installer to your root filesystem. If this is still not enough space, continue on to the next section to allocate more space by extending an underlying disk.

 

Use Space from Extended Physical (or Virtual) Disk

First you need to increase the size of the disk being presented to the Linux OS. This is most likely done by expanding the virtual disk in KVM/VMWare/Hyper-V or by adjusting your RAID controller / storage system to increase the volume size. You can often do this while Linux is running; without shutting down or restarting. I’ve extended my 100GB disk to 200GB for my example machine.

Once that is done, you may need to get Linux to rescan the disk for the new free space. Check for free space by running cfdisk and see if there is free space listed, use “q” to exit once you’re done.

If you don’t see free space listed, then initiate a rescan of /dev/sda  with echo 1>/sys/class/block/sda/device/rescan. Once done, rerun cfdisk and you should see the free space listed.

Select your /dev/sda3 partition from the list and then select “Resize” from the bottom menu. Hit ENTER and it will prompt you to confirm the new size. Hit ENTER again and you will now see the /dev/sda3 partition with a new larger size.

Select “Write” from the bottom menu, type yes to confirm, and hit ENTER. Then use “q” to exit the program.

Now that the LVM partition backing the  /dev/sda3 Physical Volume (PV) has been extended, we need to extend the PV itself. Run pvresize /dev/sda3 to do this and then use pvdisplay to check the new size.

As you can see above, my PV has been increased from 98.5GB to 198.5GB. Now let’s check the Volume Group (VG) free space with vgdisplay.

We can see above that the VG has 100GB of free space. Now let’s check the size of our upstream Logical Volume (LV) using lvdisplay, extend the LV to use up all the VG’s free space with lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv, and then check the LV one more time with lvdisplay to make sure it has been extended.

At this point, the block volume underpinning our root filesystem has been extended, but the filesystem itself has not been resized to fit that new volume. To do this, run df -h to check the current size of the file system, then run resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv to resize it, and df -h one more time to check the new file system available space.

And there you go. You’ve now taken an expanded physical (or virtual) disk and moved that free space all the way up through the LVM abstraction layers to be used by your (critically full) root file system.


Source: https://packetpushers.net/ubuntu-extend-your-default-lvm-space/#:~:text=To%20use%20up%20that%20free,to%20make%20sure%20it%20changed.


Wednesday, March 16, 2022

How to Reset Forgotten Ubuntu Password in 2 Minutes

 

Step 1: Boot into recovery mode

Switch the computer on. Go to the grub menu. Generally, it appears automatically – if not, then hold down the shift key or press Esc key until the boot menu appears.

If you’re using Oracle VirtualBox or VMware, you have to hold down the shift key when the logo of Oracle or VMware appears.

In the grub menu, select the “Advanced Options for Ubuntu”:

Advanced boot options in Grub menu of Ubuntu
This is grub screen

In here, you’ll see the option to go to recovery mode:

Boot into recovery mode

It will bring you to a black screen with several lines of output being displayed in a flash. Wait for a few seconds here.

Step 2: Drop to root shell prompt

Now you’ll be presented with different options for recovery mode. Here you need to choose “Root – Drop to root shell prompt“.  Just press the enter key to select this option. Like in the picture below:

Root shell prompt allows you to reset password in Ubuntu

You’ll see that when you select the root shell prompt option, an option to enter commands appears at the bottom. This is your root shell prompt and this is where you’ll use the commands to reset the password.

Step 3: Remount the root with write access

You need to have write access to the root partition. By default, it has read-only access.

Use the command below to remount it with write access:

mount -rw -o remount /

Step 4: Reset username or password

Here, you’ll be given root access. Use the following command to list all the users available:

ls /home

Based on this command, choose the “username” for which you want to reset or (say) hack the password. Now, use the following command to reset the password for the selected “username“:

passwd username

It prompts for a new password. Enter the new password twice:

Enter new UNIX password:
Retype new UNIX password:

VoilĂ ! There you go. You have just successfully reset the password. Now exit the root shell prompt:

exit

When you exit, you’ll be back at the recovery mode menu. Select the normal boot option here.

Use recovery mode to boot normal after resetting password in Ubuntu

There will be a warning about graphics mode compatibility. Don’t worry. A complete reboot will fix any issues with this.

You should now be able to log in with the new password.


Source: https://itsfoss.com/how-to-hack-ubuntu-password/


Monday, February 7, 2022

How to get full PC memory specs (speed, size, type, part number, form factor) on Windows 10

wmic memorychip list full

wmic memorychip get devicelocator, manufacturer, partnumber, serialnumber, capacity, speed, memorytype, formfactor

wmic memorychip get devicelocator, manufacturer

wmic memorychip get devicelocator, partnumber

wmic memorychip get devicelocator, serialnumber

    Quick tip: In the command, you can also replace "devicelocator" with "banklabel" to list the serial number showing the bank's physical label where the memory is located on the motherboard. For example, wmic memorychip get banklabel, serialnumber

wmic memorychip get devicelocator, capacity

    Quick tip: The capacity information is displayed in bytes, but you can divide the number by 1,073,741,824 (1 gigabyte in bytes) to convert the data into gigabytes

systeminfo | findstr /C:"Total Physical Memory"

wmic memorychip get devicelocator, speed

wmic memorychip get devicelocator, memorytype

Memory types the command can identify:

0: Unknown.

1: Other.

2: DRAM.

3: Synchronous DRAM.

4: Cache DRAM.

5: EDO.

6: EDRAM.

7: VRAM.

8: SRAM.

9: RAM.

10: ROM.

11: Flash.

12: EEPROM.

13: FEPROM.

14: EPROM.

15: CDRAM.

16: 3DRAM.

17: SDRAM.

18: SGRAM.

19: RDRAM.

20: DDR.

21: DDR2.

22: DDR2 FB-DIMM.

24: DDR3.

25: FBD2.

26: DDR4.

wmic memorychip get devicelocator, formfactor

0: Unknown.

1: Other.

2: SIP.

3: DIP.

4: ZIP.

5: SOJ

6: Proprietary.

7: SIMM.

8: DIMM.

9: TSOP.

10: PGA.

11: RIMM.

12: SODIMM.

13: SRIMM.

14: SMD.

15: SSMP.

16: QFP.

17: TQFP.

18: SOIC.

19: LCC.

20: PLCC.

21: BGA.

22: FPBGA.

23: LGA.

24: FB-DIMM


Source: https://www.windowscentral.com/how-get-full-memory-specs-speed-size-type-part-number-form-factor-windows-10


Wednesday, December 22, 2021

How to upgrade Debian 9 Stretch to Linux Debian 10 Buster

 Introduction

Debian is a popular version, or fork, of the Linux operating system.

The most recently released version is Debian 10, codenamed Buster. The previous version Debian 9 Stretch is officially supported until June 2022. The newer version offers a longer support period and new features, so it is highly recommended to upgrade if running Debian 9.

This tutorial will walk you through how to upgrade from Debian 9 (Stretch) to Debian 10 (Buster).

Prerequisites

  • A system running Debian 9
  • A Debian user account with sudo privileges
  • Access to a command line/terminal window (CtrlAltF2)
  • A recent snapshot (backup) of the system

Upgrade to Debian Version 10 Buster

Make sure to back up your system and data prior to upgrading. That way, if anything breaks during the upgrade, you can easily restore your system configuration.

Step 1: Update Package Manager and Repositories

By default, Debian 9 refers to the repositories designated for Stretch.

1. First, create a backup copy of the /etc/apt/sources.list file:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

2. Then, open the file for editing (we are using GNU nano for text editing):

sudo nano /etc/apt/sources.list

3. Change all the references in this file from Stretch to Buster. The entries should appear as follows:

deb http://deb.debian.org/debian debian buster main

deb http://deb.debian.org/debian buster-updates main

deb http://deb.debian.org/debian buster/updates main
Debian Version 10 Buster successful install

4. Save the file using the keyboard combination Ctrl+and Exit by pressing Ctrl+X.

You can also check for FTP download mirrors to replace the web address .

Step 2: Upgrade from Debian 9 to Debian 10

1. Update the local package lists:

sudo apt-get update

2. Next, run updates on the software packages to prepare for the operating system upgrade:

sudo apt-get upgrade

3. Finally, run the distribution upgrade:

sudo apt-get dist-upgrade

4. Once the process completes, reboot the system to boot into Debian 10 Buster:

sudo reboot

Step 3: Verify Debian 10 Update

You can use the hostnamectl command to display the OS version with the command:

hostnamectl

The Operating System field should display Debian GNU/Linux 10 (buster).

The output should appear as:

PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

(Optional) Step 4: Remove Outdated Packages

After the upgrade to Debian 10, your system might have outdated packages and dependencies which are no longer necessary.

To remove outdated packages, run the --purge autoremove command:

sudo apt --purge autoremove

Conclusion

By following the directions above, you should have successfully upgraded from Debian 9 to Debian 10.


Source: https://phoenixnap.com/kb/how-to-upgrade-debian-9-stretch-to-debian-10-buster