Tag Archives: bash

Managing a Service on Linux with systemctl

Managing services on a Linux server is essential for any DevOps/System administrators job requirements. Sometimes we want to shutdown a service permanently; Like Apache, or MySQL. We do not want it restarted automatically when we reboot the server. Or we want to make a service automatically enabled. Using systemctl makes the job a lot easier.

The standard way to do that is using systemd process. Which is now available on most Linux distros. On Ubuntu 15.x on wards, including 16.04 and above versions, this can be easily accomplished using systemctl command line tool provided through systemd.

Techie by day, blogger by night. Love the outdoors, enjoy traveling and building new and interesting things. Follow me if you want to know something.

How-to Disable Password Authentication on Linux

This how-to will explain how to disable password based authentication on Linux based systems. It is in continuation of our series on System Security. With the first one published on SSH keys based authentication. We wrote this as a lot of you sent us messages, on social media, to add tutorials on how to secure the server by disabling the password based authentication.

We recommend that the administrator should not attempt to disable password based authentication unless SSH keys are correctly setup and users can easily login using that method.

This is the second article in the series on “Systems Security”. The articles in the System Security series are listed below.

  1. How to setup SSH keys based authentication
  2. How to disable password based authentication (current article)
  3. How to setup UFW Firewall

Techie by day, blogger by night. Love the outdoors, enjoy traveling and building new and interesting things. Follow me if you want to know something.

Howto Login to servers using SSH keys authentication

Using public key authentication is far more secure and smart way to manage server authentication. And it is quite easy to implement and use. Fortunately, unix/linux terminals allow users to create public/private SSH keys combination that can be used to authenticate and login to servers without any hassle.

The traditional SSH authentication using the combination of username/password is good but really not that secure anymore. The passwords can be guessed or even broken using brute force attack. At times even a compromised terminal can give away the passwords to hackers.

This is the first article in the series on “Systems Security”. The complete list of articles in the System Security series are listed below.

  1. How to setup SSH keys based authentication (current article)
  2. How to disable password based authentication
  3. How to setup UFW Firewall

Techie by day, blogger by night. Love the outdoors, enjoy traveling and building new and interesting things. Follow me if you want to know something.

How to check elapsed time in Terminal

When we have processes running for a while and we want to know how long they have been running, there are a few nifty ways we can check them on Mac and Linux/Unix. Here is one such method to check elapsed time in BASH.

First grab the process ID (PID) using the following command. In the following command, we are trying to grab the process ID of mongoDB.

pgrep mongo

pgrep command tells shell prompt on Mac/Linux/Unix terminal to capture the process ID (PID) of the process we are interested. In this case it is mongoDB.

Techie by day, blogger by night. Love the outdoors, enjoy traveling and building new and interesting things. Follow me if you want to know something.