Introduction
Imagine a futuristic city where everything runs on advanced technology, including an extensive underground system managed by the city's eco-scientists.
In this scenario, you will step into the role of an eco-scientist tasked with setting permissions using Hadoop's HDFS Shell chmod command within the city's underground data storage infrastructure.
Setting Permissions
In this step, you will learn how to set permissions using the chmod command in Hadoop's FS Shell.
Switch to the
hadoopuser account:su - hadoopCreate a new file for demonstration purposes:
echo "Hello, Hadoop FS Shell chmod" > /home/hadoop/demo_file.txtPut the file to HDFS:
hdfs dfs -put /home/hadoop/demo_file.txt /Set permissions for the
demo_file.txt:hdfs dfs -chmod 644 /demo_file.txt
With 644 as the permission mode, it means:
- The owner of the file (user) has read (4), write (2), and no execute (0) permissions.
- The group (group) has read (4) permissions only.
- Others (others) have read (4) permissions only.
So, the command hdfs dfs -chmod 644 /demo_file.txt will set the permissions of the file /demo_file.txt in HDFS to read and write for the owner, read-only for the group, and read-only for others.
Modifying Permissions
In this step, you will modify the permissions of the existing file using the chmod command.
Let's change the permissions of the
demo_file.txtto read-only for the group and others:hdfs dfs -chmod 444 /demo_file.txtVerify the updated permissions of the file:
hdfs dfs -ls /demo_file.txt
In summary, we can see a file with permission mode 444 allows read access to the owner, group, and others but does not allow write or execute access to anyone.
Summary
In this lab, we delved into the world of setting and modifying permissions using Hadoop's FS Shell chmod command within a futuristic underground data storage infrastructure.
By following the step-by-step instructions, learners can gain hands-on experience in managing permissions effectively in a Hadoop environment. This lab aims to provide a practical understanding of permission settings for Hadoop HDFS operations.



