A Journey through Files and Permissions ๐Ÿš€

Asif ShaikhAsif Shaikh
2 min read

1. Create and Explore: A Simple File Adventure ๐Ÿ“‚๐Ÿ”

๐ŸŒŸ Let's Start by Creating a File:

Begin your command line escapade by crafting a simple file using the trusty touch command:

touch filename.txt

A file named 'filename.txt' has sprung into existence in your current directory.

The Power of ls -ltr:

ls -ltr
  • owner โ€” The owner of the file or application.

  • "chown" is used to change the ownership permission of a file or directory.

  • group โ€” The group that owns the file or application.

  • "chgrp" is used to change the group permission of a file or directory.

  • others โ€” All users with access to the system. (outised the users are in a group)

  • "chmod" is used to change the other users permissions of a file or directory.

    As a task, change the user permissions of the file and note the changes after ls -ltr

  • 2.Write an article about File Permissions based on your understanding from the notes.

  • ๐Ÿ“š Read (r): Allows seeing what's inside.

  • ๐Ÿ–Š๏ธ Write (w): Grants the power to edit or add new things.

  • ๐Ÿš€ Execute (x): Gives permission to run a file, like opening a treasure chest.

๐Ÿ•ต๏ธโ€โ™€๏ธ Decoding ls -ltr Output:

After typing ls -ltr, you'll see a code like rw-r--r--. Each part of this code represents permissions for the owner, group, and others.

  • ๐Ÿ‘‘ Owner: The creator with full control.

  • ๐Ÿ‘ฅ Group: Friends who share the file, with their own set of powers.

๐ŸŒ Others: Everyone else, each with their level of access.

chmod 700 filename.txt

Read about ACL and try out the commands getfacl and setfacl

๐Ÿš€ Exploring Access Control Lists (ACL):

Now, imagine adding a magical layer to permissions with Access Control Lists (ACL). Use two spells

๐Ÿ•ต๏ธ getfacl: To see the magical settings of a file.

getfacl filename.txt

This command reveals the detailed ACL settings for 'my_file.txt', showcasing specific permissions beyond the traditional trio.

๐Ÿ› ๏ธ setfacl: To cast your own spells and grant specific access.

setfacl filename.txt

Here, you're granting the user 'user' read and write permissions through ACL.

See your files transform, allowing specific access beyond the traditional permissions.

Embark on this enchanted journey, where files, permissions, and spells come together in harmony. Happy magic-making in your digital kingdom! ๐ŸŒŒ๐Ÿง™โ€โ™‚๏ธ

Happy Learning..

0
Subscribe to my newsletter

Read articles from Asif Shaikh directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Asif Shaikh
Asif Shaikh