Enabling collaboration with setgid directory

Create and configure setgid directories for collaboration – RHCSA Objective Preparation

GNU/Linux filesystem permissions and rights are the basis of the system’s security, and one of it’s principles is the clear separation of rights to files and folders. In a heavily multiuser environment, such as a school’s server, file rights prevent a user by default to accidentally delete or overwrite another’s documents. However, there are use cases where multiple users need to access (read, write, and even delete) other user’s files – such may be the case in the above mentioned school server, where students work on the same project. In this section of RHCSA exam preparation we will learn how to create an environment for such collaboration, using the setgid (set groupID) technique. Note that while we perform these steps on a recent operating system, the setgid isn’t a new thing, and you will find it in any and all distributions.

In this tutorial you will learn:

  • How to add users to a supplementary group
  • How to use set-GID on a directory
  • How to check proper ownership within the set-GID directory
  • How to use the special directory as a member of the group

Read more

GNU/Linux General Troubleshooting Guide for Beginners

GNU/Linux General Troubleshooting Guide for Beginners

In this guide, our goal is to learn about the tools and environment provided by a typical GNU/Linux system to be able to start troubleshooting even on an unknown machine. In this tutorial you will learn:

  • How to check disk space
  • How to check memory size
  • How to check system load
  • How to find and kill system processes
  • How to user logs to find relevant system troubleshooting information

Read more

Results of running the application

How to persist data to PostgreSQL in Java

Java is perhaps the most widely used programming language nowadays. It’s robustness and platform-independent nature enables Java based applications to run on mostly anything. As is the case with any application, we need to store our data in some sort of reliable way – this need called databases to life.

In Java database connections are implemented by JDBC (Java Database Connectivity API), that let’s the programmer handle different kind of databases in almost the same way, which makes our lives much easier when we need to save or read data from a database.

In this tutorial we will create an example Java application that will be able to connect to a PostgreSQL database instance, and write data into it. To check that our data insertion is successful, we’ll also implement reading back and print the table we inserted data into.

In this tutorial you will learn:

  • How to setup the database for the application
  • How to import PostgreSQL JDBC Driver into your project
  • How to insert data into the database
  • How to run a simple query to read a database table’s content
  • How to print fetched data

Read more

Ubuntu 20.04 Webmin Installation

How to install Webmin on Ubuntu 20.04

Webmin is an everyday tool for the sysadmin who would rather not leave his or her browser. It provides an all-in-one tool to manage your Linux box without the need to open a console. From backups to clustering, filesystems and system update, many aspects of your system is only a few clicks away with this compact tool.

In this tutorial we will install the latest stable Webmin to a freshly installed Ubuntu 20.04 system. It is a nice characteristic of Webmin that it does not really care if this distribution’s release only came out a few days back, it does have a package for it, and it does install and run on it without any issues. To test this tool’s capabilities, we’ll perform a full system update of the operating system using the WUI (Web-based User Interface).

In this tutorial you will learn:

  • How to install required dependencies for Webmin
  • How to download Webmin .deb package from the command line
  • How to install Webmin from .deb package
  • How to access the Webmin interface with a browser
  • How to perform a full system update with Webmin
  • How to administer the Webmin server with systemd

Read more

Using cookies in PHP

How to enable sessions in PHP with cookies

Cookies are all around in our everyday life while we browse the Internet. Most people wouldn’t know much about them, if not for those “our website uses cookies to be operational” signs that are on mostly any page now since GDPR. Cookies have a long history if sometimes being good, sometimes bad. As it is usual with most aspects of the world, this technology can be used in a good or bad way.

In this tutorial we will explore cookies a bit from the server side programming perspective: we’ll create an example cookie in PHP, and store the visitor’s chosen username in it. The cookie will reside in the browser of the visitor, so on the next visit we can read it and use it to greet the visitor on the username submitted.

Our simple webpage will recognize the visitor as long as the cookie is present in the browser. We do not store any information on the server side: if the visitor first checks in from a PC, and next time from a smartphone, we will not know it is the same individual. This is one of the main point with cookies: we can only identify the given client, and only as long as the data is provided by that particular browser.

In this tutorial you will learn:

  • How to setup the test environment
  • How to write a simple example program that uses cookies
  • How to test the workings of the program
  • How to reset the environment

Read more

Adding swap space to the system

Add new partitions, logical volumes, and swap to a system non-destructively – RHCSA Objective Preparation

Disk and space management is an essential knowledge of a sysadmin. It is his or her everyday job to handle disk issues. As part of the RHCSA exam preparation, we will learn how to add new space of various types to the system, using the tools provided by RHEL8. We already covered many of these tasks, and in this tutorial we will focus on adding new space without harming the data contained in the system.

In this tutorial you will learn:

  • How to add new partitions to RHEL8
  • How to add new logical volumes to RHEL8
  • How to add swap to RHEL8

Read more

Creating new physical volume with LVM

Using LVM to manage physical volumes, volume groups, and logical volumes – RHCSA Objective Preparation

As part of the RHCSA exam preparation, we already learned how to manage partitions on disk. Partitions are useful to separate disk space (for example, separating database-related files from webserver-related files), but we have a much more flexible solution that can separate or aggregate storage space.

This solution is called LVM, the Logical Volume Manager. LVM allows us to see multiple disks as one filesystem, thus overcoming the limitations of a physical disk’s site. We can also create software mirroring on disks to protect or data written to the filesystem. In this tutorial we’ll cover the basics: we’ll manage the three layers of LVM, physical volumes, volume groups and logical volumes.

In this tutorial you will learn:

  • How to create and remove physical volumes
  • How to assign physical volumes to volume groups
  • How to create and delete logical volumes

Read more

Mounting filesystem by label

Configure systems to mount file systems at boot by universally unique ID (UUID) or label – RHCSA Objective Preparation

While in the desktop world we rarely change our hard drive – and that mostly indicated by hardware failure – in the server world it isn’t uncommon for the underlying storage environment to change over time.

In a SAN (Storage Area Network) environment, for High Availability, a server can reach it’s storage trough many paths, in reality distributed and mirrored to multiple disks in the storage network. If some paths change, the server needs to identify the “disk” again. That’s why it is recommended to use special identifiers set on the device, and mount by these identifiers, not by device name which may change. In this part of RHCSA exam preparation tutorial, we’ll add a new disk to our test machine, and configure mounting by UUID (Universally Unique IDentifier) and by label.

In this tutorial you will learn:

  • How to get UUID of a given device
  • How to get and set label of a device
  • How to mount device by UUID
  • How to mount device by label

Read more

Creating 1 GB partition with fdisk

How to list, create, delete partitions on MBR and GPT disks – RHCSA Objective Preparation

Disk partitions are the basis of storing our data on disks. To be able to handle partitions, in this part of RHCSA exam preparation tutorial we will add an empty disk to our test RHEL 8 system, and create, list, and delete a new partition on it. First we will use the classic MBR (Master Boot Record) setup, then we’ll do the same on GPT (GUID Partitioning Table) setup. GPT is a more advanced partitioning technique that allows large partitions, whereas MBR is limited to 2 TB disk space per partition. So if that doesn’t seem like a very limiting size at the moment, think of the trend of disk usage, which may be not that much from the end user perspective, but certainly it is from the Linux system administration job perspective.

In this tutorial you will learn:

  • How to create a new MBR partition using fdisk
  • How to list classic partitions using fdisk
  • How to delete partition using fdisk
  • How to create GPT partition using gdisk
  • How to list GPT partitions
  • How to delete GPT partitions

Read more

NRPE - Nagios Remote Plugin Executor

How to setup NRPE for client side monitoring

Nrpe, or Nagios Remote Plugin Executor, is the client side service of a monitoring setup. The monitoring server will send commands to the client, which listens passively when got no work to do. Upon incoming command, the nrpe checks it’s local configuration, and executes the plugin configured with the command, then sends back the results to the server for processing. You can read more about the server side installation in the Nagios installation guide, while this guide will focus on the client side.

In this tutorial you will learn:

  • How to install NRPE on Debian/Red Hat based distributions
  • How to configure NRPE to accept commands from the server
  • How to configure a custom check on the server and client side

Read more

JSch example execution

Executing commands on a remote machine from Java with JSch

SSH is an every-day tool of any Linux System Administration job. It is an easy and secure way to access remote machines on the network, transfer data and execute remote commands. Apart from interactive mode, there are many tools exist that enable automation of remote tasks that also rely on the existing ssh server/client architecture. For one such tool, you can read about ansible on Ubuntu for example. You can also find many implementations of the ssh client, but what about accessing the abilities ssh provides from code?

JSch is a project that implements the ssh protocol in Java. With it’s help, you can build applications that are capable to connect to and interact with a remote or local SSH Server. This way your application is capable of managing any aspect of the target machine that you could complete with your native ssh client, which gives yet another powerful addition to the already vast Java toolset.

In this article we will import JSch into our Java project, and develop the minimal necessary code pieces to create an application that can log in to a remote machine’s ssh server, execute some commands in the remote interactive shell, closes the session, then presents the output. This application will be minimal, however, it may give a hint of the power it provides.

In this tutorial you will learn:

  • How to import JSch into your Java project
  • How to setup the test environment
  • How to implement the UserInfo interface in a custom class
  • How to write an application that initiates interactive ssh session

Read more

Successful installation of VMware Tools.

How to install VMware Tools on RHEL 8 / CentOS 8

When speaking of virtualization, VMware is a solution that can’t be ignored. While the true power of virtualization lives in the datacenters, we live in the age where anyone can run a virtual machine or two on a desktop or a laptop, given it is equipped with enough resources. These virtual machines are computers running inside a computer, and this setup has countless benefits and use cases. For instance, if you have a new software you’d like to test, you can do so in a virtual machine before installing it directly on a device you use for everyday work.

To work with these virtual machines with ease, we can integrate them with our Hypervisor – in this case, VMware – to enable the operating system running as guest to use the capabilities of the virtualization software. In this tutorial we will install the integration software, called VMware Tools on a virtual machine running RHEL 8 / CentOS 8, that is hosted in VMware Player. The same in-guest steps apply on the datacenter version of VMware regarding the tools installation. Note however, that Red Hat ships the open-vm-tools with the distribution, which is what VMware also recommends to use instead of the tools we’ll now install. Why are the tools shipped with the distribution recommended? They can be updated along with the distribution within the regular update process, while VMware’s tools need to be updated by hand (or automation, but unneeded effort anyway).

While the following steps will result in a working integration, please consider the above when you setting up your virtual systems. Outdated virtualization integration tools are a bad thing, which you will experience when you upgrade your hosts, and hundreds of alerts will appear on the vCenter consoles.

In this tutorial you will learn:

  • How to download VMware tools using VMware Player
  • How to present installation source to the virtual machine
  • How to remove open-vm-tools
  • How to install and configure VMware Tools

Read more