In Linux SSH
Test_ Temporary User Permission Bash Program
ANSWER:

OUTPUT SCREENSHOT:

COPY CODE:
Test_Temporary.sh:
# Script to add a user to Linux system
if [ $(id -u) -eq 0 ]; then
read -p "Enter UserName : " user #enter the name of the user to be
added
read -s -p "Enter Password : " password #enter the password for the
provided username
egrep "^$user" /etc/passwd >/dev/null
if [ $? -eq 0 ]; then
echo "$user exists!"
exit 1
else
pass=$(perl -e 'print crypt($ARGV[0], "password")' $password)
sudo useradd -m -p $pass $user
[ $? -eq 0 ] && echo "User has been added to system!.." ||
echo "Failed to add a user!...."
fi
else
echo "Only Root Can add a user to the system" #shows error
exit 2
fi
this is bash scripting. a. When a file is created on Linux Operating System, What are the default permissions of the file? b. Write a command to find the total disk space used by a specific user on linux system? c. what is "s" permission bit in a file?
What Linux command should you type to give/add 01-hello bash shell script permission to run ("execute") for anyone?
I need help with this. 10-21. Briefly describe the following Linux commands and acronyms. ssh: telnet: traceroute: TCP: LAN: DNS: ftp: ssh: ping: env: g++: gcc: 22. Show a command that will create a file named "etc.tar" in your home directory from recursively going through all of the files in the "/etc" directory. In other words, the "etc.tar" file will include the files in the "/etc" directory as well as all of its subdirectories. IMPORTANT: This command must work for...
Linux and Sys administrator SSH uses _____ key encryption
Linux 1. How can you enable, on a default Linux installation, root remote access through ssh? 2. A boot loader can be configured to boot multiple Linux kernels that use the same partition as their root file system. True or False? 3. Which of the following occurs first when a computer is booted? the BIOS displays a setup menu of configuration options. The kernel starts the init program. The BIOS loads the MBR. The CPU starts executing commands found in...
Linux & Unix Write a bash program to indent the code in a bash source file. Conditions: The source file will contain only printing characters, spaces, and newlines. It is not necessary to check for invalid input. The source file will not contain comments (words beginning with #). Requirements: Read from standard input, write to standard output. Code inside while statements should be indented 2 spaces. Be sure your program includes all of the following: ...
Problem 1 Write a BASH script to create a user account from the Linux system on which your script is run. The script should process two positional parameters. First positional parameter is supposed to be a string with a user name (e.g., user_name) Second positional parameter is supposed to be a string with a user password (e.g., user_password) In your script: Check if two positional parameters were passed to your script when it was invoked If NOT, print an appropriate...
1. Assume the following struct is declared for the permission list of a file in Linux. Each permission (u or g or o) is represented as an octal. For example, u=7 means rwx, u=5 means r-x. Note: "unsigned char" means a byte, not a character or a letter or a string. typedef struct { unsigned int uid; // owner id unsigned int gid; // group id unsigned char u; // owner's permission unsigned char g; // group's permission unsigned char...
Write a bash program. Let the user select arbitrarily a number between 1 to 200. Let the program guess that number. When the number guess is equal to the number selected by the user then the user will input "Y" (standing for yes). When the guess number is less than the selected number, the user inputs "L" (standing for less) and "M" otherwise. Let the program make minimum number of guesses
in ssh (on the Linux command line), in what file is a user's private key normally stored?