Question

In: Computer Science

Linux Operation For the following exercises, ensure the following regarding the student1 and student2 accounts: The...

Linux Operation

For the following exercises, ensure the following regarding the student1 and student2 accounts:

  • The home directories are /home/student1 and /home/student2
  • The student accounts are in the students group
  • The umask for the student1 and student2 accounts is: 022, (should be by default)
  • The “student” account home directories have 755 permissions.
  • Execute steps in the “Lab 2 setup supplement” document on D2L to get the above set up.

Also note that, the term “home directory” below, if not specified in detail, refers to the home directory of the current user (e.g. /home/student1 for the student1 account). This does not specify just the “/home” directory.

*** On the lab answers – be sure you use the form fields, so that your answers are show in red ***

SECTION 1 – Absolute/Relative Paths, Files and Directories:

  1. Log into the student1 account. Enter the command to tell you what your current directory is:

     .

Now cd to the /tmp directory. Enter two commands, which will change your directory to the home directory for student1:

      and      

Verify these two commands work by displaying your current directory after each one is run.

  1. Ensure you are in your home directory for student1. List the contents of the /tmp directory using an absolute path name:      .

List the contents of the /tmp directory using a relative path name:      .

After listing the contents of a directory, does your present working directory change?      .

What command changes your present working directory?      .

  1. Ensure you are in your home directory for student1. Change your current directory to the root (/) directory. What command did you use:      .
  2. Enter the cd ~ command. What directory are you now in?         .

Explain what “~” represents:      .

  1. Ensure you are in your home directory for student1. Create a file called labfile1 with the touch command in the /tmp directory using a relative path name. What command did you use:

     .

Create another file called labfile2 with the touch command in the /tmp directory using an absolute path name. What command did you use:        .

  1. What is the file size of files created with the touch command?        .

Now touch one of these files again. What, if anything is different in the file’s characteristics?        .

  1. Ensure you are in your home directory for student1. Using the echo command with output redirection, and an absolute path, add 10 lines to the /tmp/labfile1 file. Make each line just one word - line1, line2, through line10. What is the new file size of the /tmp/labfile1 file?      .

In what storage units are files displayed in unix?        .

Ensure you are in your home directory for student1. Use the tail command and a relative path to display the last 5 lines of the /etc/passwd file. What command did you use:        .

Ensure you are in your home directory for student1. Use the head command and an absolute path to display the first 5 lines of the /etc/group file. What command did you use:        .

  1. Ensure you are in your home directory for student1. Create a new subdirectory in your home directory called subdir1. What command did you use:        .

Change your current directory to the subdir1 directory using a relative pathname. What command did you use:      .

Change back to your home directory for student1. Create a file called labfile3 in this subdir1 directory using the touch command with a relative pathname. What command did you use:

     .

  1. Ensure you are in your home directory for student1. Execute the following commands: ls –al subdir1 and ls –ald subdir1. What is the difference between these 2 commands?

     .

Solutions

Expert Solution

To create user with 022 permissions by default:
You can setup umask in /etc/bashrc or /etc/profile file for all users. By default most Linux distro set it to (022). Open /etc/profile or ~/.bashrc file, enter:
# vi /etc/profile

sudo useradd -m -d /home/student1 student1

sudo useradd -m -d /home/student2 student2

sudo su student1

sudo usermod -a -G www-data student1

sudo chmod -R 755 /home/student1
sudo chmod -R 755 /home/student2

sudo su student1
cd ~/.
/home/student1

cd /tmp
cd ~/.
cd /tmp
ls -ltr
cd /

cd /tmp
touch labfile1
touch /tmp/labfile2

cd /home/student1
echo line1, line 2, line3 , line4 , line 5, line 6 , line 7, line 8, line 9, line 10 >> /tmp/labfile1

ls -ltr /tmp

ext4

cd /home/student1
tail -n 5 /etc/passwd
head -n 5 /etc/passwd
mkdir subdir1
cd subdir1
cd .
cd subdir1
mkdir labfile3
ls –al subdir1
dipalys files in directory
ls –ald subdir1
difplays directory information


Related Solutions

why is it important to ensure that a patient knows how to perform exercises correctly
why is it important to ensure that a patient knows how to perform exercises correctly
The following information is provided regarding Garry Limited’s accounts receivable and allowance for doubtful accounts: Accounts...
The following information is provided regarding Garry Limited’s accounts receivable and allowance for doubtful accounts: Accounts Receivable, January 1, 2019 $1,450,000 Collections of Accounts Receivable during the year $1,700,000 Write-offs of Accounts Receivable $ 425,000 Accounts Receivable December 31, 2019 $1,800,000 Allowance for Doubtful Accounts (December 31, 2019 balance (before bad debts adjusting entry at December 31, 2019) $ 155,000(debit) Required: (a) Calculate the credit sales for the year 2019. (b) Provide the journal entry that was made to write-off...
Regarding accounts receivable and an allowance for uncollectible accounts, which of the following statements is false?...
Regarding accounts receivable and an allowance for uncollectible accounts, which of the following statements is false? Group of answer choices Net realizable value equals the sales price of an item less reasonable further costs to both make the item ready to sell and to sell it. An aging of accounts receivable is a determination of how long each receivable has been on the books. The net realizable value of accounts receivable is decreased when a bad debt is written off....
Which of the following is correct regarding QuickBooks Online Chart of Accounts?
Which of the following is correct regarding QuickBooks Online Chart of Accounts? Multiple Choice By customizing the QuickBooks Online Chart of Accounts to align with the business tax return, countless hours can be saved in preparation time QuickBooks Online does not encourage editing of its Chart of Accounts since too many errors can be made by changing what was initially set up when the company was organized. QuickBooks Online does allow editing of the accounts in the Chart of Accounts, however, it only allows...
Linux operation 1. Explain what this command does: rpm –qai | more ..... ? 2. Ps...
Linux operation 1. Explain what this command does: rpm –qai | more ..... ? 2. Ps – Af |grep -v ^root, Explain how this command to find application processes could helpful in the real world to the system administrator?? 3. Clearly describe 3 valid command options, and their meaning, of this command used to add users? 4. List 2 different variants of the Unix (not Linux) operating system, as well as their corresponding vendor (the company that developed them) ?...
Regarding Risk Assessment How important is it to ensure the system is secure to avoid penetration?...
Regarding Risk Assessment How important is it to ensure the system is secure to avoid penetration? PLEASEMAKE COPY PASTE AVAILABLE
provide 3 different distributions of Linux. compare and contrast regarding strengths for each distribution. [ only...
provide 3 different distributions of Linux. compare and contrast regarding strengths for each distribution. [ only 10 sentences or less }
The projected balance of accounts payable at the end of the first year of operation is?
A family friend, Mr. Burn Out availed of the early retirement scheme offered by his employer. He said that he was already tired of the same routine of spending eight full hours in an office doing the same thing for the last twenty years. Mr. Burn Out plans to get into the field of entrepreneurship. He would invest part of his retirement pay in a business that would deal with the sale of medical supplies to local clinics and hospitals....
Which of the following statements regarding closing journal entries is correct? A) Revenue accounts are debited...
Which of the following statements regarding closing journal entries is correct? A) Revenue accounts are debited and the income summary account is credited. B) Expense accounts are debited and the income summary account is credited. C)Expense accounts are credited and retained earnings account is debited. D)Revenue accounts are debited and retained earnings account is credited.   Please explain
Using repl.it, your own Linux installation, or other Linux emulator do the following and take screenshots...
Using repl.it, your own Linux installation, or other Linux emulator do the following and take screenshots for the steps that require it. Paste your screenshots into a word document, in the same order as the questions, and upload the file by 11 AM on Friday. 1. Show the contents of your home directory and take a screenshot 2. Create a directory named IT305 in your home directory and take a screenshot 3. Create a file called oldfile.txt in your home...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT