
Concept explainers
IF YOU DONT KNOW HOW TO BASH SCRIPT IN LINUX THIS DOESNT APPLY TO YOU.
anybody who knows linux can you help me, Write a script to automate the creation of new users and groups, i have this so far but the groups isnt working. I NEED HELP MAKING THIS WORK. HERE IS MY SCRIPT.
#!/bin/bash
#location of txt with usernames
userfile=./users
#location of txt with groupnames
groupfile=./groups
#extract usernames
username=$(cat ./users | tr 'A-Z' 'a-z')
#define default password for usernames
password=ch@ng3m3!
#run loop to add users
for user in $username
do
useradd $user
echo $password | passwd --stdin $user
groupadd -f $groups
done
#extract groupnames
groupname=$(cat ./groupnames | tr "A-Z' 'a-z')
For groups in $groupname
do
groupadd -f $groups
done
#read total users processed with script
echo "$(wc -l ./users) users have been created"
tail -n$(wc -l ./users) /etc/passwd
#read total groups processed with script
echo "$(wc -l ./groups) groups have been created"
tail -n$(wc -l ./groups) /etc/group

Trending nowThis is a popular solution!
Step by stepSolved in 2 steps

- Note that lastlog file in /var/log is not a text file, to view the file use lastlog command linux redhat command only plsarrow_forwardAnswer the following Linux question below. You need to change the rights of a file called lala.txt. What chmod command would you use to assign rights so: that the file owner can edit the file users who are members of the group that owns the file can edit it too and users who are not members of the owner group can view, but cannot edit. Use chmod followed by a number, not letters, chmod ###arrow_forwardAre there any advantages to transitioning from the Bash shell to an alternative shell?arrow_forward
- linux.txt is owned by a group that has full control over the file's access settings. Specify who has read/write access to linux.txt. Which of these commands will allow the user/owner to make whatever changes they want to the file?arrow_forwardBash Shell Scripting – Permissions Need help with solving this problem: Write a bash shell script with the following capabilities: Create a new bash script ~./test5.sh Add a simple echo "Hello World" statement and save the script. Run the ls –l command to inspect the files permissions. Who is the owner of this file? Can you execute this script? If not, why not? Use the chmod command to change the file permissions to you can execute the file. Run the ls – l command to inspect the files permissions. What changed in the permissions to allow you to run the script? Take a screenshot of the console output.arrow_forwardYou are using the scripting statement case in a script and keep getting a message such as the following: script 1: line 10: syntax error: unexpected end of file what is the likely cause of the error? a) You didn't have a default condition set. b) You forgot to close the case with esac. c) You were using the old [ ] bash style insted of [[ ]]. d) You were comparing an integer when you should have been comparing a string.arrow_forward
- Write a bash script that accepts aperson’s name as a command-line argument and simply prints out the following greeting: "Good day, <name_entered>! Nice to meet you!", where <name_entered> is a positional parameter (i.e., a command-line argument) passed to the script. If the user does notenter a command-line argument when invoking this shell script, you will simply output: "Hope you have a great day!", without any name displayed. How to do this??arrow_forwardA file called linux.txt has a group named "owner" that has full control over the file's access. Provide details on who has access to linux.txt and what privileges they have. Which of the following commands will provide the user/owner full access to the file?arrow_forwardWrite a bash script that displays the command line parameters starting from third argument to the last. The file name is lab1_2.sh for example bash lab1_2.sh aaa bbb ccc ddd eee fff ggg hhh ccc ddd eee fff ggg hhh The line ends with a new linearrow_forward
- I am having an issue with declaring a construtor - LINE 104 TimeOff::TimeOff(string, int, double, double, double, double, double) Can you review my code and let me know what I am doing wrong. I got help from your site, however, they created 2 files, a header and a source cpp. My assignment is to turn in one file, with the headers and source code. See below and attached //Sharissa R Sullivan //03.18.23//More about Classes #include <iostream>#include <string>using namespace std; //Number Days Classclass NumDays{ // Access specifer private: double hours; double days;public: NumDays(double h = 0) { hours = h; days = h / 8; } void setHours(double h) { hours = h; days = h / 8; } void setDays(double d) { days = d; hours = d * 8; } double getHours()const { return hours; } double getDays()const { return days; } //overloaded + operator NumDays operator+(NumDays&…arrow_forwardOn the cmsy255 server, write a bash shell script called usrinfo that displays information about a specified user. Make sure the script file is executable. Also make sure that you can run the script without having to specify the directory. For example, you should NOT have to enter ./usrinfo in order for it to run. The script should: ● ● ● Accept 1 argument from the command line (this is the User ID that you want to display info for) finger the User ID display any lines from the who command that match this User ID display any lines from the ps -ef command that match this User ID In addition, if the number of arguments is not exactly 1, display an appropriate error message and exit with an exit code of 1.arrow_forwardBook reference: Windows PowerShell Step by Step 3rd Edition - Ed WilsonChapter 19 4. In the below PS script what is the use of calling the Buffersize, Count and Quiet parameters in the Test-Connection cmdlet? Param([string]$computer = $env:COMPUTERNAME) if(Test-Connection -computer $computer -BufferSize 16 -Count 1 -Quiet) { Get-WmiObject -class Win32_Bios -computer $computer } Else { "Unable to reach $computer computer"}arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





