Linux

Creating users and their passwords with Ansible

This article will teach you how create user accounts with the configuration management software Ansible. You will learn how to create users with passwords, SSH-only users and users with temporary passwords that must be changed. Some background on passwords on Linux The file /etc/passwd hints at passwords, but stores only an “x” or other character where the password has been stored historically. The real passwords are stored in the file /etc/shadow, in a hashed format.

Using grep on files with no newlines

I had a big, automatically-generated HTML file without newlines and wanted to see all occurrences of a certain image name. Using the command grep my_image.png just outputs the whole file - not useful! While writing the question to the unix section of StackExchange, I found a way to do it with grep: grep -oE ".{30}my_image.{30}" This command yielded the desired result: Each occurrence on a separate line, with 30 characters before and after.