Question

In: Computer Science

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.

Solutions

Expert Solution

Please UPVOTE

(a) make it executable

To create a file in Linux , we can use the touch command.

Command:

touch file

In order to give executable permission , we use the chmod command followed by '-x' and the file name.

Command:

chmod +x file

(b) enable the SUID

chmod u+s file

u+s gives the SUID

ls -l command should show you whether SUID is applied or not. Simply look at the first field of ls -l output. The s in -rwsr-xr-x indicates SUID bit.

In some cases you will see a capital S instead of a small s that we saw above. Captal S indicates that there is no executable permission applied to that file/or script.

Command used:

chmod u+s file

ls -l file

(c) use the ACL to add a permission for the root user.

We need to run the setfacl command with below format to set ACL on the given file. We are going to give a rwx (read write execute) access to root user as asked in question on the created file named  'file'.

Command used:

setfacl -m u:root:rwx file

  • setfacl: Command
  • -m: modify the current ACL(s) of file(s)
  • u: Indicates a user
  • root: Name of the user
  • rwx: Permissions which you want to set
  • file: Name of the file

To check the default ACL values for a file or directory, use the getfacl command followed by /path to file or /path to folder.

If you have any doubts or any modifications, please comment and I'll help you out.

Please UPVOTE


Related Solutions

File permissions let us control who can: a. change how files are executed only b. create...
File permissions let us control who can: a. change how files are executed only b. create files only c. delete files only d. read, write, and execute a file
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
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?
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.
Create MySortedArrayCollection.java This file is inherited from SortedArrayCollection.java This file implements MySortedArrayCollectionInterface.java ****** Make new and...
Create MySortedArrayCollection.java This file is inherited from SortedArrayCollection.java This file implements MySortedArrayCollectionInterface.java ****** Make new and just complete MySortedArrayCollection.java, dont modify others //////////////////////////////////////////////////////// SortedArrayCollection.java public class SortedArrayCollection<T> implements CollectionInterface<T> {    protected final int DEFCAP = 100; // default capacity    protected int origCap; // original capacity    protected T[] elements; // array to hold collection elements    protected int numElements = 0; // number of elements in this collection    // set by find method    protected boolean found;...
create an executable bash runtests.sh as follows: The script must include the definition of a recursive...
create an executable bash runtests.sh as follows: The script must include the definition of a recursive function, explore The script prompts the user to enter a directory name and an executable name, and checks that they are both readable and executable (terminating with an error message if not). It then passes the two names to the explore function. The explore function carries out a recursive traversal of the directory and all its subdirectories, and runs the executable on each of...
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 all necessary code to make this main function work. It is not allowed to change...
Create all necessary code to make this main function work. It is not allowed to change the main function. int main() {        int ListDataSample1[] = { 1, 1, 1 };        int ListDataSample2[] = { 2, 2, 2 };        List<int> List1 = List<int>(ListDataSample2, 3);        List<int> List2 = List<int>(ListDataSample2, 3);               cout << "List1 :" << List1 << endl;        cout << "List2 :" << List2 << endl << endl;        List1 += List2;               cout...
Create a file named StudentArrayList.java,within the file create a class named StudentArrayList. This class is meant...
Create a file named StudentArrayList.java,within the file create a class named StudentArrayList. This class is meant to mimic the ArrayList data structure. It will hold an ordered list of items. This list should have a variable size, meaning an arbitrary number of items may be added to the list. Most importantly this class should implement the interface SimpleArrayList provided. Feel free to add as many other functions and methods as needed to your class to accomplish this task. In other...
Create a Java class file for a Car class. In the File menu select New File......
Create a Java class file for a Car class. In the File menu select New File... Under Categories: make sure that Java is selected. Under File Types: make sure that Java Class is selected. Click Next. For Class Name: type Car. For Package: select csci2011.lab7. Click Finish. A text editor window should pop up with the following source code (except with your actual name): csci1011.lab7; /** * * @author Your Name */ public class Car { } Implement the Car...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT