Question

2. [5] What is the command used to limit the default permissions for new file and new directory? Please write the command to
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer 2 :

umask is the command that is used for setting the default permission for new file and new directory. umask set the permission in the terminal you are currently working , if you want to change the umask value permanently then you need to change your ~/.bashrc file.

uname 066 is the command to set the default file permission to -rw------- and default directory permission to drwx--x--x.

Explanation:

for example:

umask 002 , if we are using the umask value in numeric form (in numeric form value for  read permission is 4, for write is 2 and for execute is 1) these values gets subtracted from 666 when a file is created and from 777 when a directory is created. In numeric first number is to give permission to user and second is to give permission to group and third number is to permission for others(any one else). for example: after running umask 002, if we create a file then it will have permission 664 i.e. user and group have the read and write permission while other has read permission only. In numeric for, by default execution permission is not provided to the file.

There is another way we can set the umask value, by using the symbols(abbreviations) , r for read , x for execute, w for write, u for user, g for group, o for other.

for example : umask u=rwx,g=rw,o=r

in this for we are providing the permission values i.e if we create a file or directory, then user(owner) can read write and execute the file and groups can read and write while others can just read. these values should be comma separated, spaces are not allowed.

in another way, example: umask u+x,g+r,o-w
in this for what , umask take the original permissions set by operating system and + (means add) or -(means remove) the permission for file and directories. in this example, we are adding the execution permission to user and adding read permission to group and removing the write permission for other. Other default permission remains same.

in symbolic for these permission are applied for both files and directories

Add a comment
Know the answer?
Add Answer to:
2. [5] What is the command used to limit the default permissions for new file and...
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
  • 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...

  • do numbers 4-8 4. Given any directory, use the Is command to display: • all files...

    do numbers 4-8 4. Given any directory, use the Is command to display: • all files and sub-directories starting with the letter "D" (note do not list anything in any sub-directory) • its immediate sub-directories (sub-directories only, and no other ordinary files) its immediate hidden sub-directories only - take a screenshot (#3-3) that clearly shows the command and the result. 5. Assume that the following files are in the working directory: $ ls intro notesb ref2 section 1 section3 section4b...

  • 1.Below is the output of the command ls –l report -rw-rw-r--+ 1 max pubs 9537 01-12...

    1.Below is the output of the command ls –l report -rw-rw-r--+ 1 max pubs 9537 01-12 23:17 report Explain the meaning of the first field (i.e. -rw-rw-r--+) 2.Provide the command to modify the permissions on the file report above so that the user sam has read-only permission, and the user zach has read & write permissions 3.Provide the command to remove the rule that gives sam permission to access the file report

  • Question 11     You are in the oranges directory. Write the command to copy the mandarin...

    Question 11     You are in the oranges directory. Write the command to copy the mandarin file to the apples directory. Use a relative path. 2 points Question 12     Which command do you use to rename files and directories?        A.         uname        B.         mv        C.         rn        D.         rename 2 points Question 13     You are in the oranges directory. Write the command to list...

  • What does your .profile file say is your default PATH? (what command did you use). What...

    What does your .profile file say is your default PATH? (what command did you use). What is the PATH command syntax to add the directory $HOME/bin to your PATH?

  • Problem 8 (18 points): Answer the following questions regarding managing files and directories: a) What command...

    Problem 8 (18 points): Answer the following questions regarding managing files and directories: a) What command would remove the directory /trashbin and all of the files and subdirectories inside of it? b) What command flag can you use with cp so that it doesn’t accidentally overwrite a file if it already exists? c) What command exists to delete a directory if and only if it is already empty? d) Which command can be used to rename a file or directory?...

  • please answer as many as possible, all the answers will be like 1 line long. By...

    please answer as many as possible, all the answers will be like 1 line long. By default, which account is the owner of a file or directory? Name the three types of access permissions. Name the three categories of accounts which are used in assigning access permissions. Who can change the access permissions on a file or directory? What would you enter on the command line if you wanted to see the access permissions of entries in your current directory?...

  • 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...

  • Assuming the current permissions are set to-rwxrwxrwx for each of the files listed below, what would...

    Assuming the current permissions are set to-rwxrwxrwx for each of the files listed below, what would be the symbolic permissions you would need to supply to the chmod command to produce the permissions for each filename presented below: dr--r-xrwx 5 dede instr 287 oct 4, 2010 entry! -rw--w x 5 alby stdnt 481 Oct 4, 2010 entry3

  • QUESTION 1 From YOUR home directory, execute a find command string that will locate the file...

    QUESTION 1 From YOUR home directory, execute a find command string that will locate the file called resolv.conf. Include the -exec flag in the find command to cat the file to the screen. Begin your find search from the letc directory Select the correct find command string below that will accomplish this. find /etc-name 'resolv.conf -cat D find /etc-name 'resolv.conf -exec cat 0 find. -name 'resolv.conf -exec cat 0\ find /-name 'resolv.conf' -exec cat 0 QUESTION 2 What find command...

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