Question

In: Computer Science

Create by using Linux server • Create a file name it foo.txt • Remove all permissions...

Create by using Linux server

• Create a file name it foo.txt
• Remove all permissions from foo.txt
• What happen if you try to read the file?
• Change foo.txt permission to read and write only for owner
• Change foo.txt permission to read for group
• Change foo.txt permission to read and write everyone

Solutions

Expert Solution

1) Create a file name it foo.txt

Solution :

vi foo.txt

press i for input mode in linux and write the content and then save it with :wq!

ls -l (to see the permission of files in the current directory)

total 8
-rw-r--r-- 1 runner runner 13 Oct 14 04:46 foo.txt
-rw-r--r-- 1 runner runner 31 Oct 14 04:46 main.sh

2) Remove all permissions from foo.txt

It can be done with chmod option and remove all permissions of owner group and others with 000 respectively.

chmod 000 foo.txt

ls -l

total 8
---------- 1 runner runner 13 Oct 14 04:46 foo.txt
-rw-r--r-- 1 runner runner 31 Oct 14 04:46 main.sh

3)  What happen if you try to read the file?

It will be showing permissioned denied because its permission to read has been revoked.

cat foo.txt
cat: foo.txt: Permission denied

4)  Change foo.txt permission to read and write only for owner

chmod 600 foo.txt
ls -l
total 8
-rw------- 1 runner runner 13 Oct 14 04:46 foo.txt
-rw-r--r-- 1 runner runner 31 Oct 14 04:46 main.sh

5)  Change foo.txt permission to read for group

chmod 640 foo.txt
ls -l
total 8
-rw-r----- 1 runner runner 13 Oct 14 04:46 foo.txt
-rw-r--r-- 1 runner runner 31 Oct 14 04:46 main.sh

6)  Change foo.txt permission to read and write everyone

chmod 646 foo.txt

ls -l
total 8
-rw-r--rw- 1 runner runner 13 Oct 14 04:46 foo.txt
-rw-r--r-- 1 runner runner 31 Oct 14 04:46 main.sh


Related Solutions

1. When a file is created on Linux Operating System, What are the default permissions of...
1. When a file is created on Linux Operating System, What are the default permissions of the file? 2. Write a command to find the total disk space used by a specific user on linux system? 3. What is "s" permission bit in a file? 4. Explain the difference between grep and egrep? 5. Write a command to list files where third letter is x or y? 6. Write command to remove array element with id 5? 7. Write a...
Create a file and change the file permissions to (a) make it executable, (b) enable the...
Create a file and change the file permissions to (a) make it executable, (b) enable the SUID, and (c) use the ACL to add a permission for the root user. Do a long listing of this file. LINUX command line / virtual box.
[Linux permissions] Suppose that you are a superuser on a Linux system, and there is a...
[Linux permissions] Suppose that you are a superuser on a Linux system, and there is a file “/home/alice/foo”, which is owned by an ordinary user Alice. You need to give a permission to read a this file to an ordinary user Bob, but no one else (of course, you as superuser will be able to read it too). Explain how you will do it. Note: You do not have to provide specific commands, just a short description will suffice. [Limitations...
[Linux permissions] Suppose that you are a superuser on a Linux system, and there is a...
[Linux permissions] Suppose that you are a superuser on a Linux system, and there is a file “/home/alice/foo”, which is owned by an ordinary user Alice. You need to give a permission to read a this file to an ordinary user Bob, but no one else (of course, you as superuser will be able to read it too). Explain how you will do it. Note: You do not have to provide specific commands, just a short description will suffice.
Using node.js, create the following tasks. 1. Set up a server and HTML file server as...
Using node.js, create the following tasks. 1. Set up a server and HTML file server as shown in the videos. Once you have it successfully running, make the following adjustments A. When a 404 error (file not found) occurs, display a funny message about the file missing and/or did you forget how to type? B. If the user enters a request for the home page (index.html) then: Display an index.html page you have created which includes your name, course number,...
USING COMMAND PROMPT ON LINUX. show how... Linux Users, Groups, and Permissions Lab Objective: Understand how...
USING COMMAND PROMPT ON LINUX. show how... Linux Users, Groups, and Permissions Lab Objective: Understand how to create user accounts Understand how to create group accounts Creating good password policies Understanding permissions and file sharing Setup: You will need a Ubuntu Server VM Walk Through: You are a system administrator who has been tasked to create user accounts for new users on your system. You can pick whatever theme you like as long as there are protagonist and antagonist users:...
Permissions– commands and options Provide commands with screenshots. (a) Create a new file in the root...
Permissions– commands and options Provide commands with screenshots. (a) Create a new file in the root directory. What is the default permission for this file? (b) Set the directory permission to 400. What does it mean? (c) Set the directory permission to 100. What does it mean? (d) Set the directory permission to 200. What does it mean?
Linux regular expressions: file name: lab3test.txt Create regular expressions that meet the following criteria. You may...
Linux regular expressions: file name: lab3test.txt Create regular expressions that meet the following criteria. You may use grep or egrep to answer these questions. 1.Match any lines that contain a phone number with the format 222-222-2222.
PLEASE USE LINUX/UNIX 1.Use either pico, vi, or cat to create the following file and name...
PLEASE USE LINUX/UNIX 1.Use either pico, vi, or cat to create the following file and name it as “mysedfile”: Name Class1 Class2 Class3 Tom 92 94 88 Nancy 91 85 95 Lisa 99 77 96 Jerry 84 98 90 2. Please use sed command(s) to complete the following tasks. display Tom’s record. display Lisa’s record. display both Tom’s and Lisa’s records. remove the blank line(s) from “mysedfile.” replace all the digits with *.
linux Regular expressions file name: lab3test.txt Create regular expressions that meet the following criteria. You may...
linux Regular expressions file name: lab3test.txt Create regular expressions that meet the following criteria. You may use grep or egrep to answer these questions. 1.Display all lines where the employee’s age is greater than 40 years old. Again, don’t think of this as a number, think of it as a series of characters.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT