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

In linux , Using a simple text editor, create a text file with the following name...
In linux , Using a simple text editor, create a text file with the following name "Test" and content: GNU GENERAL PUBLIC LICENSE The GNU General Public License is a free, copy left license for the GNU General Public License is intended to guarantee your freedom to GNU General Public License for most of our software; it applies … 2-Write the command to create the text file. 3-Print the file permissions. 4-Create a directory named "361" 5-Copy file "Test" to...
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:...
in linux operating systerm - for the file –rw—wx-rwx foo.txt use symbolic representation change the permissions...
in linux operating systerm - for the file –rw—wx-rwx foo.txt use symbolic representation change the permissions so that a) The Owner and the group do not have any permissions. Others can open it. b) The owner can write to it. The group can open it. Others will not have any permissions. c) Only others have permission to open it. d) Only the owner can open it.
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.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT