172k views
4 votes
Login with your user account and list the contents of your home directory

Create directory and sub-directory: VIT1202/Lab1

Create the following files in Lab1 named readonly.txt, readwrite.txt and readexecute.txt.

Long List the files in the Lab1 directory

Set the File Permissions for each of those files as per following: User has full access, groups and others only have read access to the file readonly.txt

User has full access, groups only have read and write access, and others haveread access to the file readwrite.txt

User has full access, groups and others have read and execute access to the file readexecute.txt

User Mgnoonan
by
8.3k points

1 Answer

1 vote

Final answer:

To manage files and permissions in a Unix/Linux system, one can use the 'ls', 'mkdir', 'touch', and 'chmod' commands to create directories, files, list files with detail, and set appropriate permissions for those files respectively.

Step-by-step explanation:

To perform the activities listed in your question, you need to be familiar with command-line interface operations on a Unix/Linux system. Here is how you can accomplish the tasks:

  1. Login to your user account by entering your username and password when prompted on the system.
  2. List the contents of your home directory by using the ls command.
  3. Create a directory and sub-directory with mkdir -p VIT1202/Lab1. The '-p' option ensures that the parent directory, VIT1202, is created if it does not exist.
  4. Create the files within the Lab1 directory using the touch command: touch VIT1202/Lab1/readonly.txt VIT1202/Lab1/readwrite.txt VIT1202/Lab1/readexecute.txt.
  5. List the files in the Lab1 directory in long format with ls -l VIT1202/Lab1.
  6. Set the file permissions using the chmod command:
    • chmod 744 VIT1202/Lab1/readonly.txt gives full access to user, and read access to groups and others.
    • chmod 664 VIT1202/Lab1/readwrite.txt gives full access to user, and read and write access to groups, and read access to others.
    • chmod 755 VIT1202/Lab1/readexecute.txt gives full access to user, and read and execute access to groups and others.

Remember to use these commands without typos to avoid errors and execute them within your Unix/Linux environment's terminal interface.

User Non
by
7.7k points