Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Ruby or Bash script that will print usernames of all users on a Linux system together with their home directories. Here's some example

Write a Ruby or Bash script that will print usernames of all users on a Linux system together with their home directories. Here's some example output: gitlab:/home/gitlab nobody:/nonexistent . As you can see, each line is a concatenation of a username, the colon character (:), and the home directory path for that username. Your script should output such a line for each user on the system. Next, write a crontab entry that accomplishes the following: ● Runs once every hour. ● Takes the output of your above script and converts it to an MD5 hash. ● Stores the MD5 hash into the /var/log/current_users file. ● On subsequent runs, if the MD5 sum changes, it should log this change in the /var/log/user_changes file with the message, DATE TIME changes occurred, replacing DATE and TIME with appropriate values. Make sure to replace the old MD5 hash in /var/log/current_users file with the new MD5 hash. 


Both the script and crontab entry should be provided for the answer to be complete.

Step by Step Solution

3.43 Rating (156 Votes )

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Matlab An Introduction with Applications

Authors: Amos Gilat

5th edition

1118629868, 978-1118801802, 1118801806, 978-1118629864

More Books

Students also viewed these Programming questions

Question

Case : Karl and June Monroe

Answered: 1 week ago