Author: Sahil Suri

5 Ways to generate strong passwords in Linux

Introduction Its extremely important for any system administrator to maintain strong passwords for their servers and databases so that they do not get exposed to hackers in case of brute force attacks or other password infiltration attempts. In this article we’ll share five different command line tools using which you can generate potent and strong passwords.   Method 1: Using OpenSSL OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) network protocols and related cryptography standards required by them. The openssl program is a command line tool for using the various cryptography functions of OpenSSL’s crypto library from the shell.  Some of it’s popular uses are listed below: Creation and management of private keys, public keys and parameters Public key cryptographic operations Creation of X.509 certificates, CSRs and CRLs Calculation of Message Digests Encryption and Decryption with Ciphers Random string generation OpenSSL is generally installed by default on most Linux distributions. In case it’s missing you may install it using the command “yum install openssl”. OpenSSL is part of the base repository for RHEL/Centos operating systems. We will use the rand (Generate pseudo-random bytes) option with the openssl command to generate an alphanumeric string which can be used as a password. [root@linuxnix ~]# openssl rand -base64 15 1Caxj6P7GfJzJwDeJP2G [root@linuxnix ~]# Base64 is an encoding format used in applications and different...

Read More

Configuring chrooted sftp user accounts in Linux

Introduction In one of our previous articles, we demonstrated how to setup an ftp server using vsftpd on a Linux system. FTP is a great way to transfer data between systems but it is not very secure since the data being transferred is not encrypted and therefore exposed to hacking attempts. SFTP is a secure form of the FTP program wherein the entire user session including typing in the password to login to the system is in encrypted. Another useful facet of the SFTP program from an administrators’ perspective is that it is included with the openssh package which is generally installed by default on most UNIX systems. Also, since SFTP is based on SSH it works on port 22 so we do not need to open ports 20 and 21 required by FTP. To add another layer of security restriction upon our SFTP setup, in this article we will explain how to setup chrooted SFTP accounts. A chrooted SFTP account will not allow the user to access any file or directory outside it’s own home directory which is extremely helpful when we want to prevent users from accessing and modifying each other’s files. Steps to configure chrooted SFTP user account: For the purpose of this demonstration, we will use an RHEL 6.8 system as our SFTP server and we will set up a user named ‘sahil’ as our chrooted...

Read More

3 ways to find file/directory count in a given directory in Linux

Introduction As a system administrator, it’s important to be aware of how to check the number of files and sub-directories reside within a given directory on your Linux system. Although rare, occasionally you might run into situations wherein the file count in a directory is so high that all the inodes assigned to the file system get exhausted and users will no longer be able to create new files. In this article, we’ll demonstrate a couple of ways we could use to obtain the count of the number of files and directories that reside within a given directory. Method 1: Using the wc (word count) command If we want to count the number of files and directories in Linux/UNIX distribution then using the ls command and piping it’s output to the wc command is a simple way to accomplish this. The command ls will list the directory content i.e. the names of the files and directories that reside with the directory and the wc command is used for displaying the word count and when used with the -l option, wc can count the number of lines in the input. [sahil@linuxnix ~]$ ls dir1 dir2 dir3 dir4 $ ls | wc -l While this is good we will not show hidden files or directories. Hidden files start with a dot.  To list these we can use the option -a or...

Read More

Over 16,000 readers, Get fresh content from “The Linux juggernaut”

Email Subscribe

ABOUT ME..!

My photo
My name is Surendra Kumar Anne. I hail from Vijayawada which is cultural capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. At present I work at Bank of America as Sr. Analyst Systems and Administration. You can contact me at surendra (@) linuxnix dot com.