≡ Menu

In C programming, variadic function will contribute to the flexibility of the program that you are developing.

To understand this flexibility, let us start with a basic example.

If we like to add two numbers, we might write a code like this:
(more…)

SELinux RestoreconOn your Linux server, having proper SELinux security context for files and directories is very important.

When you add your custom file to a directory that is already managed by SELinux policy, and if your custom file doesn’t have the proper SELinux context, then you will not get the expected result.

restorecon stands for Restore SELinux Context.

restorecon command will reset the SELinux security context for files and directories to its default values. This will only reset the type attribute of SELinux context.

In this tutorial, we’ll explain how to use restorecon command with some practical examples.
(more…)

hard diskIf you are a sysadmin, managing your Linux server’s hard disk partition is a critical task.

In this tutorial, we’ll focus on how to use sfdisk command-line utility to manage your hard disk partitions.

While sfdisk is similar to fdisk, there are few partition manipulation activities that are very easy to perform in sfdisk. For example, you can create new partitions in an non-interactive method using sfdisk.

The following sfdisk activities are covered in this tutorial:
(more…)

Sometimes when you do a git push, you might get the following permission error message.

This error typically happens when multiple users are working on a particular git repository.

The following git push error indicates that it doesn’t have enough permission for adding a new object to the ./objects directory under your repository.

Apart from the obvious permission issue, there is also another underlying problem that needs to be addressed, which is explained in this tutorial.
(more…)

PuTTY PlinkPlink stands for PuTTY Link.

Plink is a companion command-line utility for PuTTY.

On a very high-level:

  • Use PuTTY for interactive SSH session from your Windows to Linux Servers
  • Use Plink for non-interactive SSH session to execute remote linux commands for automation purpose from your Windows

(more…)

3 Methods to Connect to MySQL from PHP using Example Code

To get most out of your MySQL database, it is important to understand how to connect from your custom PHP program to MySQL database.

This tutorial explains the following three methods along with appropriate example PHP program, which will explain how to connect from your PHP to MySQL database.

  • Connect using mysqli extension (Recommended)
  • Connect using PDO (Recommended)
  • Connect using traditional legacy mysql_ functions (Deprecated)

For this, you should install php-mysql package.
(more…)

Nginx LocationIf you are running Nginx webserver, it is important for you to understand how the location directive works.

Nginx uses location directive to decide what configuration it should apply based on prefix or the pattern in the incoming URL.

For example, from what directory it should serve the image files when an URL ends with *.gif or *.png or any other image filename extension.

In this tutorial, we’ll explain the following with proper examples:

  1. Default Location Directive Setup
  2. Change the Default Nginx Root Location (i.e DocumentRoot)
  3. Define Custom 404 Page Not Found Using Location
  4. Define Multiple Custom 50x Server Errors using Location
  5. Serve Your Website Images from a Custom Location
  6. Exact Match Using = (Equalto Sign) Location Modifier
  7. Case-Sensitive Regular Expression Match Using ~ (Tilde Sign)
  8. Case-InSensitive Regular Expression Match Using ~* (Tilde-Asterisk Sign)
  9. ^~ Best Non RegEx Match (Carat-Tilde Sign)
  10. Nginx Location Related Error Messages
  11. Summary of Location Modifiers
  12. Define Custom Named Location Using @ (At Sign)
  13. Nginx Location Matching Processing Sequence and Logic

(more…)

Jenkins is an open source DevOps tool that will help you to deploy and automate your enterprise application.

In Jenkins, by default you can create users, but not groups.

So, if you want groups in Jenkins, you have the following few options:

  • Use OpenLDAP with Jenkins
  • Use Active Directory with Jenkins
  • Use Unix user/group database. This will use PAM library to integrate with Jenkins.
  • Use “Role-based authorization strategy” plugin for Jenkins

(more…)