Create a process in the background such as datesleep 10


Question:

The output of the commands has to be captured and write some information about command in an word file.Project 2 - Part 1 Process Management

In a new Linux virtual machine within VMPlayer:

1. To obtain process information for the UNIX or Linux system, use the command ps-ael. Use the command man ps to get more information about the ps command. Describe what this command does.

2. Construct a process tree similar to Figure 1. Look up the Linux command pstree -p and describe what it does. Then type in the command the capture the output.

1737_Fig.jpg

3. Create a process in the background ( such as (date;sleep 10; date) >date.out & ), and run ps -ael and identify the added processes running now.

4. Verify the job is running by typing the command jobs. Describe what this command does.

5. Type the following program in a textfile called three_forks.c. Compile it using gcc and then run it in the background.

a) Describe what the fork() call does.

b) Including the initial parent process, how many processes are created by the program shown? Verify your answer by running ps -ael.

c) Kill the processes created in this part one by one and terminate them by the kill command. Show each is killed by running ps -ael.

Tasks

1. Create a user called "victim" with sudo privileges and create a directory called "public" for him with rwx access for all.

2. Create a user called "attacker" with no sudo privileges. Log in as this user and create a malware file called "date" to mascaraed the date Linux command. This malware file should give sudo privileges to attacker.

3. Run a scenario in a Linux bash shell to demonstrate and verify that after the scenario is executed, attacker is given sudo rights by victim. Test actually that attacker has sudo privileges now.

Capture all the key screens using a screen capture tool (such as Windows 8) snipping tool. Put all captures in you MS Word project report file with some explanation of what each major step is.


Answer the following questions:

1. If after giving himself sudo privileges, attacker wanted to change victim's password, what commands should type in Linux?

2. Look up what bashrc file is and in one paragraph describe it.

#include

#include
// Note that fork() returns a pid - it returns a 0 to the child process...

int main()

pid_t mypid, pid;
printf("Start: pid = %d\n", getpid());
/* fork a child process */ pid  fork();
if (pid = 0)
printf("Child -
else
printf("Parent - ");
printf("After 1st fork: pid = %d\n", getpid());
/* fork another child process */
pid = fork();
if (pid = 0)
printf("Child - ");
else
printf("Parent - ");
printf("After 2nd fork: pid = %d\n", getpid());
/* and fork another */ pid = fork();
if (pid = 0)
printf("Child - ");
else
printf("Parent - ");
printf("After 3rd fork: pid = %d\n", getpid());
while ( );
return;

The output of the commands has to be captured and write some information about command in an word file

Solution Preview :

Prepared by a verified Expert
Operating System: Create a process in the background such as datesleep 10
Reference No:- TGS01528177

Now Priced at $75 (50% Discount)

Recommended (95%)

Rated (4.7/5)