Question

Objective: Practice common UNIX commands. Procedure: The following list of Unix commands are given for self-learning....

Objective:

Practice common UNIX commands.

Procedure:

  1. The following list of Unix commands are given for self-learning. Use 'whatis' or 'man' command to find out about each command. Your document should include the description or screen shots of the output from each of the command.

Commands:

  1. df
  2. du
  3. gzip
  4. file
  5. history
  6. wget
  1. Changing access rights:

chmod u+x Dir1.0            adds execute permission for the owner

chmod go-w file1              removes write permission for the group and others

chmod ugo=rw testfile     sets the permissions for everyone to read and write, but not execute

chmod u=rwx newDir      sets the permissions for the owner to read, write, and execute

  1. How to check access rights for files or directories?
    1. Use the command in (a) to find out the access rights for the file named /etc/passwd.
  • Who is the owner of this file?
  • What is the permission for the group on this file?
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Q.1 How to check access rights for files or directories?
Answer:
command :- "ls -l" or "ls -al"
'ls' is used for list all the files
'-l' used to get more information about the files in a directory,
'-la' options can be used to get all the details of the hidden files:

command output:

$ ls -la /root
total 24
drwxr-xr-x 2 root root 4096 2009-12-16 01:10 .
drwxr-xr-x 23 root root 4096 2010-02-18 10:14 ..
-rw------- 1 root root 123 2010-01-21 15:49 .bash_history
-rw-r--r-- 1 root root 2227 2007-10-20 11:51 .bashrc
-rw-r--r-- 1 root root 141 2007-10-20 11:51 .profile
-rw------- 1 root root 868 2009-12-16 00:47 .viminfo

if you want to check the access rights of /root directory then try above command.

(.) refers to the directory itself where as (..) refers to the parent directory and all other files individual lines refer to information about the different files present inside the directory.

Permissions for files are represented r,w and x which is the intial parameter of each lines
r refers to the read permission.
w refers to the write permission.
x refers to the execute permission.

lets take an exmple of below lines.

   rwxr-xr-x 2 root root 4096 2009-12-16 01:10 . (Here the first character refers to file type .d means its a directory)

The next three of letters after the file type in a file list (rwx) shows the permissions for the user, or file owner.
i.e. he has all permissions to read write and execute.
The next three of characters shows the permissions for the group category.
i.e the group has only read and execute access
The last three of characters (r-x) shows the permissions for the final category


Q 2:Use the command in (a) to find out the access rights for the file named /etc/passwd.
Answer:
$ ls -la /etc/passwd


Q 3:Who is the owner of this file?
Answer:
try this command
$ ls -l filename
output : rwxr-xr-x 2 sampleUser root 4096 2009-12-16 01:10
Here the 'sampleUser' is the owner of the file.


Q 4 :What is the permission for the group on this file?
Answer:
lets understand in the below output.
drwxr-xr-x 2 root root 4096 2009-12-16 01:10 .
Here group permission starts from 5th to 7th character i.e. 'r-x'.

Add a comment
Know the answer?
Add Answer to:
Objective: Practice common UNIX commands. Procedure: The following list of Unix commands are given for self-learning....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please complete in JAVA only PROBLEM: CHMOD is a command in the UNIX computer system. It...

    Please complete in JAVA only PROBLEM: CHMOD is a command in the UNIX computer system. It is the command used for giving users permissions to access and change files and directories. There are 3 classes of users. They are the owner, the group and others. The permissions given are: read(r, write(w) and execute(x). The argument of the CHMOD command is a 3-character octal number (ex. 526). When each digit of that number is converted to binary, the binary digits are...

  • Assume access control list of three files are given as below in Unix directory listing. (you...

    Assume access control list of three files are given as below in Unix directory listing. (you will see something similar when you type ls -l in a unix system)   Access Control FileName Group Owner Drw-rwxr-x Classess University Nick drwxr----- bills University Kate -rwxrw-rw- list OS_Class Sandra -rwxr-x--x Assignment2 OS_Class Nancy Narrate the permission given to the owner, group and everybody for each file or folder. Hint: d- directory (if it is a folder, otherwise -) r- read permission w- write...

  • 5.Create two files also called file file1 and file2 in testdir_2 Use the ls -lR to show you created the directories 6. Change the permission of the files in the directories below and show their permi...

    5.Create two files also called file file1 and file2 in testdir_2 Use the ls -lR to show you created the directories 6. Change the permission of the files in the directories below and show their permissions testdir/testdir_1/file1 where owner has read and execute permissions testdir/testdir_1/file2 where where owner has read, write and execute permissions. Group has read only permissions 7. Create a directory called newdir/newdir_1/newdir_2 copy the file testdir/testdir_1/file1 to this directory Change the permisions of the file to owner,...

  • Write a program in C using Unix system calls and functions that will change the permissions on a ...

    Write a program in C using Unix system calls and functions that will change the permissions on a file. The executable shall be called “mychmod” and will be executed by: mychmod -u rwx -g rwx -o rwx -U rwx -G rwx -O rwx file1 file2 ... The lowercase options will add permissions while the uppercase options will remove permissions. Each of the switches is optional and should be interpreted as the ones in the Unix command chmod(1), you can review...

  • COSC 3411 /ITAP 3411 Homework (UNIX Shell Commands) How would you ensure that all ordinary files...

    COSC 3411 /ITAP 3411 Homework (UNIX Shell Commands) How would you ensure that all ordinary files created by you have rw-rw---- as default permissions? How would you sort in the background a file called "bad.txt", and place the results in a file called "sort.txt"? Archive the contents of your home directory (including any subdirectories) using tar. Compress the tar archive with gzip. Now extract their contents. Use the “find” command to locate in /docs and /usr/docs all files that Begin...

  • Unix/Linux The purpose of this lab is to practice the commands to manage and organize files...

    Unix/Linux The purpose of this lab is to practice the commands to manage and organize files and directories: How would one go about this? Thanks. Task 1: Preliminaries: 1) If you have not already done so, create a directory called bin under your HOME directory. 2) If you have not already made a copy (using ftp) of the file called famous.dat from the Assignment#1, do that now. 3) Make bin the active/working directory. Task 2: Perform all of the following...

  • UNIX File Permission help, please answer the questions in the green boxes. Thank you Lab 03...

    UNIX File Permission help, please answer the questions in the green boxes. Thank you Lab 03 File Permissions In this lab we will: learn about file permissions learn to create symbolic links and hard links Utilities that will be utilized in this Lab: us, cd, less, cat touch, chmod id umask, mkdir, In, echo and redirection Users and Groups Linux supports several methods of controlling access to files an directories. In this lab we are going to learn the traditional...

  • Cybersecurity Fundamentals Lab #9: Access ControlName: ____________________ If your Kali VM is already up and running,...

    Cybersecurity Fundamentals Lab #9: Access ControlName: ____________________ If your Kali VM is already up and running, login to the root account on the VM via ssh. It does not matter whether you use a command line or GUI sshclient. If your VM is not currently up, use the vSphere web client to start your VM before logging into it via ssh.1: Create an Unprivileged User For some labs, including this one, we will need a non-root user account on the...

  • 1. Write the command to set the following permissions on a script file with the following...

    1. Write the command to set the following permissions on a script file with the following name; myscript.sh Owner: full access; read, write and execute Group: read and execute Other: no access 2. Create a new file with the name "myfirstscript.sh". Write a new script that performs the following tasks in sequence; Display the usernames of currently logged in users; sorted from a-z HINT: You will need to filter the output of the whocommand Display a list of usernames who...

  • 9. The command "chmod 711 menu script" allows the owner read, write and execute permissions, and ...

    9. The command "chmod 711 menu script" allows the owner read, write and execute permissions, and only permission for group and other o. Explain why you would use a "Here Document "in your shell script over using the echo commands? 11. What will the following statements provide "from the main body" when the awk script is executed? Field 1 Example: one line of input "widget: 1.59 : 83 Note! the: is the delimiter. Example: Unit-widget, price per/unit -$1.59, quantity number...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT