How to use a command line random password generator PWGEN on Linux

This article will provide you with some hints on how to generate random password using shell. Among many other tools which can be used on the Linux command line to generate random passwords such as openssl, mktemp, od or /dev/urandom the specific and easiest tool designed for this purpose is pwgen.

Installation

DEBIAN/UBUNTU
# apt-get install -y pwgen
FEDORA
# dnf install -y pwgen
CENTOS
# yum install -y pwgen

Usage examples

Let’s start by generating bunch of passwords by simple executing pwgen command. If no options are used pwgen will simply spit out 160 passwords with 8 characters each:

# pwgen 
AeD7Amiv Reech6ie dei7aiPe yoogh1Ch Quoh0zae shu2Eepa aoquu3Xa aiR4Raiv
eeWah9Ro uPhe9pif uZiegh2h xie6Mail wa2xaHai saeLoh4O Yai8be7u aGhue7fe
unieB3du yaiK7She ooh0ohGe Go5zuKai Aeseeph1 UJ3Moo5i xaeg6ohG aJ8oogah
suFo3ohr jaTee0mi eeK9zuoh tho5xieP Ec6uob9j iyap1eNo at1Hahqu viebei2O
zeeg9cuX iP9pooW6 ohS1nahl zaese9Vu dee1Tooh aS2Bahyu aeH5shoh hichooW6
Aishie2v phee8Ahp ce2Peith Ez0thoos oot0Aibo aizepe8J reeC6she aihaeSh6
EVaaroh1 apuviCh2 Ui2aec5t Yoh8jong eo2zaeWo queiTo7i aebai4Oe jahj5ieN
Co5aije5 ooSh1oon taeJe5ae Kah3quie eeXae6Ma wu6ohp8U Eil4sha4 iiSohc4a
eeNg0ied HaeH3ohl Shie9aih ohC5phoi boos6euG uadai3Oo Cohpai9I thuogh8E
thie7Zai aem6sooN ieFu7uif tiewoh4U Kaes1bai Aox4zah0 OoH5utoh uo4aWied
eew7baeV Iej7piel ohMa4iet Oi2aephi Yailov9t oaTheiz2 lexea9Ie iez0The2
et3Phaey hee2Oa7u Pee1Ibee ohbae1iZ thoo9eiZ eiCh3aiw Veiqu1ph quohF2oh
xoh2Iwo3 aiQuai8i aeKae5Hi owaiz3Ve oJa2ret8 yie4baiK iex3Chug ruPie2ig
Ahv7ciev kiemok7U veiX5cae thuL0Pho AiyeuB5t ooX4igeb bi0sohBu Ohl0hoaf
Wooy1ja9 ue8ooj3B iik5yeP5 Ieboo1oi neeNiu7E aeV8aimu oojeiW6x Thoh6Eix
zoaPh1au aiCh3eem quevoo8T Iey0soRo ceiC3Do4 Dae9ua4f pieyie2U noXu5ooK
Zuexe5du oNeu8eef heu7iTah kahpa8Um thoSa7sh Lai4Keik oit7Dahc aiy5iaZo
siv2Ut3a Tha8eePh eb6ieM2c DeVie1ee Cocofo7E Rihee6ya thi1Iigi iBi6quar
Adeeh6Us Eicho5so siTho2Pu Dahcho5I kowe7Iev gee9IeNu Ohso2jae Aegha1oo
Oomil4Ee Ahghoot3 Izai3oov yegeey6C ea8uG1ai Ahsh4Aeb quie5aeR paWaiqu4

Read more

sudo install, usage and sudoers config file basics

What if you want one user to run a command as an another system user without exchanging passwords. For example, you may want an user john to run a find command or custom bash shell script as an user greg or even as a user root ( superuser ) without password exchange. In this case a sudo utility with its /etc/sudoers configuration file will be your friend. This utility is very widely used but at the same time very little understood by Linux users of all levels.

This short article describes some basic of sudo usage and format of sudoers configuration file.

sudo install

First we need to make sure that sudo and /etc/sudoers the sudo configuration file is available. To do that run:

$ which sudo

or

$ sudo -V

The first command should reveal a location of a sudo binary executable and the second program will output a version number of sudo command its self. The sudo configuration file sudoers is in most cases located in /etc/sudoers. You can use ls command to locate this file.

$ ls -l /etc/sudoers
-r--r----- 1 root root 481 2010-04-08 21:43 /etc/sudoers

Read more

How to start a docker container as daemon process

Instead of running docker container with an interactive shell it is also possible to let docker container to run as a daemon which means that the docker container would run in the background completely detached from your current shell. The following CentOS docker container will start as a daemonized container using -d option, while at the same time executing ping 8.8.8.8 using an endless bash while loop.

# docker run --name centos-linux -d centos /bin/sh -c "while true; do ping 8.8.8.8; done"

Read more

block access to facebook.com

How to block Facebook access on Linux desktop

block access to facebook.comIn this config you can find an easy and cheap solution on how to block Facebook.com on any Linux desktop using /etc/hosts file. This is not a bulletproof solution but should help as a first level privacy protection for your kids, yourself or should aid if your students do not pay enough attention in the class.

Below you can find a list of facebook.com subdomains:

  • m.facebook.com
  • upload.facebook.com
  • apps.facebook.com
  • newsroom.fb.com
  • developers.facebook.com
  • touch.facebook.com
  • pixel.facebook.com
  • static.facebook.com
  • beta.facebook.com
  • graph.facebook.com
  • login.facebook.com
  • inyour.facebook.com
  • secure.facebook.com
  • latest.facebook.com

Read more

LAMP ( Linux, Apache, MariaDB, PHP ) stack Docker image deployment

About

The automated build docker LAMP image “linuxconfig/lamp” can be used as a testing and also as a production environment for a dynamic PHP applications. It comprises of Debian GNU/Linux, Apache webserver, MariaDB a community-developed fork of the MySQL relational database management system and PHP scripting language.

Deployment

The deployment of “linuxconfig/lamp” docker image is a fairly simple procedure. Let’ start by creating a sample PHP website with a MariaDB connection handle:

<?php
$dbh = mysqli_connect('localhost', 'admin', 'pass');
if (!$dbh) {
    die('Could not connect: ' . mysqli_error());
}
echo 'Connected successfully to MariaDB database';
mysqli_close($dbh);
?>

Read more

LEMP ( Linux, Nginx, MariaDB, PHP ) stack Docker image deployment

About

The automated build docker LEMP image “linuxconfig/lemp” can be used as a testing and also as a production environment for a dynamic PHP applications. It comprises of Debian GNU/Linux, lightweight and yet powerful Nginx webserver, MariaDB relational database management system and PHP scripting language.

Deployment

The deployment of “linuxconfig/lemp” docker image is a fairly simple procedure. Let’ start by creating a sample PHP website with a MariaDB connection handle:

<?php
$dbh = mysqli_connect('localhost', 'admin', 'pass');
if (!$dbh) {
    die('Could not connect: ' . mysqli_error());
}
echo 'Connected successfully to MariaDB database';
mysqli_close($dbh);
?>

Read more

Virtualbox – PING from virtual machine results in (DUP!) duplicate packages

Symptoms

Virtual machine random network connectivity issues with VirtualBox. Using pingcommand results in:

# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=57 time=22.2 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=56 time=22.3 ms (DUP!)
64 bytes from 8.8.8.8: icmp_seq=2 ttl=57 time=22.1 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=56 time=22.2 ms (DUP!)
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, +2 duplicates, 0% packet loss, time 1009ms
rtt min/avg/max/mdev = 22.106/22.248/22.368/0.142 ms

Read more

Bitcoin mining node deployment made easy with docker

Introduction

If you feel extremely lucky or your have a supercomputer to your disposal you may try to mine for bitcoins to earn some extra cash. The complexity of Bitcoin’s block chain hashing algorithm gets stronger every 2 weeks to combat the Moore’s law so be sure to bring in some decent hardware. In this article we will show how to easily deploy a Bitcoin mining node with docker.

About

The automated trusted build of the Bitcoin mining node “linuxconfig/bitcoin-node” docker image can be used to instantly deploy a Bitcoin node on any host running docker service.

Configuration

The docker Bitcoin mining node image runs on Debian Linux and includes bitcoin daemon binaries directly downloaded from bitcoin.org. It is deployed under “root” user account. The rpcuser and rpcpassword are automatically generated during a first launch and can be located in /root/.bitcoin/bitcoin.conf.

The Bitcoin node server is configured to listen on 8333 port and this to allow for node to node commutation as well as 8332 port to accept JSON-RPC communications.

Usage

To deploy your Bitcoin node run the following linux command.

# docker run -d --name=bitcoin-node -h bitcoind -p 8332:8332 -p 8333:8333 linuxconfig/bitcoin-node

Read more