How to reset the root password in RHEL7/CentOS7/Scientific Linux 7- based systems

Objective

Resetting the root password in RHEL7/CentOS7/Scientific Linux 7

Requirements

RHEL7 / CentOS7 / Scientific Linux 7

Difficulty

MODERATE

Instructions

Things have changed in the RHEL7 world and so has the preferred way of resetting the root password. Although the old way of interrupting the boot process (init=/bin/bash) still works, it is no longer bulletproof and recommended.
‘Systemd’ uses ‘rd.break’ to interrupt the boot. Let’s have a quick walk through the whole procedure.

Read more

Command-line programs for everyday use in Linux

Introduction

I must admit, I’m a command line geek. Whenever I have the chance, regardless of desktop environment or distribution, I open a terminal and start fiddling something. This does not mean everyone must be like me, of course. If you’re the person who is mouse and GUI-oriented, no problems. However, there are situations when all you have at your disposal for a while is the command line. One of those situations might be an upgrade of your kernel/graphics drivers that leave you high and dry until the bug is reported and the developers look at the issue. You have to send a very important e-mail or you have to check the evolution of prices of your favorite laptop. All the essential desktop tasks (with some exceptions, though) that you do on a GUI-enabled machine can be done on a CLI-only machine as well, so if you’re interested…

The tasks

The everyday tasks we will refer to are the ones we usually do in a usual day, be it a work day or a weekend. We need to check our mail, maybe watch something on Youtube (yes, it’s possible), chat with our friends or simply browse away from URL to URL. These are the kinds of things we are talking about in this article. By the way, another huge advantage of the CLI approach is (besides efficiency and low resources) uniformity. You don’t have to worry, if you use many Linux computers, that some of them won’t have your favorite desktop installed: these programs we will tell you about work everywhere, GUI available or not, as long as you have a terminal emulator installed, of course. Note that this article is comprised only of ideas and suggestions, and will not guide you step-by-step on how to use the presented applications.

Web browsing

It’s true, you can’t see images , but they are practical to have, way faster and even more secure, because some of them don’t even support Javascript unless you tweak their compile options. Ladies and gents, I give you links, elinks and lynx. You can install them on almost any distribution with the native package manager, or you can install them from source, and of course compilation will not take a lot, because there are no heavy dependencies. links also offers a command-line flag (-g from graphical) that, if compiled with the right options, will offer you a very simple but fast GUI browser.

On Debian, when I wanted to do ‘links -g’, I got “Graphics not enabled when compiling (use links2 instead for graphics mode)”. After installing it, typing

  $ links2 -g

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

How to find and remove all empty files using shell command line

In this config you will learn how to find all empty files within a given directory using find the find command. Here is our sandbox directory /tmp/temp containing files from which some of them are empty:

.
├── dir1
│   ├── dir2
│   │   ├── file3
│   │   └── file4
│   ├── file2
│   └── file3
├── file1
└── file2

2 directories, 6 files

Let’s first locate all empty files recursively starting from a current working directory using find command:

$ pwd
/tmp/temp
$ find  . -type f -empty
OR
$ find  /tmp/temp -type f -empty
./dir1/dir2/file4
./dir1/file3
./file2

The following linux command will search for all empty file only within a current working directory, that is, not recursively:

$ find  . -maxdepth 1 -type f -empty
./file2

Read more

How to perform AUTH DIGEST-MD5 CRAM-MD5 command line SMTP authentication

This config will describe a procedure to login to SMTP server using AUTH DIGEST-MD5 CRAM-MD5 encryption authentication method via telnet. First, we need to install all prerequisites:

# apt-get install telnet sasl2-bin

Using telnet command we will connect to SMTP server. The sasl2-bin package contains gen-auth command which we will use to generate our BASE64 encoded response to server’s authentication challenge. Lets’ start by using telnet command to connect to our server:

$ telnet 10.1.1.11 25
Trying 10.1.1.11...
Connected to 10.1.1.11.
Escape character is '^]'.
220 mail.localhost.localdomain ESMTP Postfix (Ubuntu)

Read more

How to change sasl user’s password using saslpasswd2

This config we shortly describe how to update/change sasl user’s password. Firs, list sasl database to retrieve a list of all current users. If you know the exact user name for which you wish to change/update password that this step can be omitted:

# sasldblistusers2 
lubos@localhost: userPassword
radek@localhost: userPassword

Read more

Rygel – DLNA Share Media Server deployment using docker

About

The automated build Docker image of Rygel – DLNA Share Media Server “linuxconfig/rygel” can be used to instantly deploy DLNA Share Media Server on your docker hosts.

Configuration

The docker image with the Rygel – DLNA Share Media Server runs on Debian GNU/Linux system using official pre-compiled stable packages from a Debian repository.

Usage

To deploy your Rygel DLNA Share Media Server run the following linux command. Update media file paths to point to your media files located on your host system:

# docker run -d --net=host --name=rygel -v /path/video/files:/video -v /path/music/files:/music -v /path/pictures/files:/pictures linuxconfig/rygel

Read more

How to deny/allow access to files using .htaccess file

Question:

How can I allow and deny HTTP access to files based on file extension? I need to deny access to all TXT files.

Answer:

Below you can find a simple examples on how to regulate download access to files using .htaccess file. In the first example the following .htaccess code will block access to all files with file extension .txt to all requests resulting in HTTP ERROR 403: Forbidden..

<FilesMatch ".txt">
    Order Allow,Deny
    Deny from All
</FilesMatch>

Read more

How to start a docker with Exited (-1) status solution

Symptoms:

Any uttmpt to start, restart a docker container results in a following error:

coreos ~ # docker start 3cabf046fa66
Error response from daemon: Cannot restart container 3cabf046fa66: [8] System error: Unit docker-3cabf046fa66eb3484a8be2c6ac162ee4e1e5c838a74b93f9a66546c9f206c24.scope already exists.
FATA[0000] Error: failed to start one or more containers 

Read more