Time for action – demonstrating the default security
When we have previously shown listings of files, we have seen user and group names for them. However, we have not really explored what that means. Let's do so.
Create a test text file in the Hadoop user's home directory.
$ echo "I can read this!" > security-test.txt $ hadoop fs -put security-test.txt security-test.txt
Change the permissions on the file to be accessible only by the owner.
$ hadoop fs -chmod 700 security-test.txt $ hadoop fs -ls
The output of the preceding command can be shown in the following screenshot:
Confirm you can still read the file.
$ hadoop fs -cat security-test.txt
You'll see the following line on the screen:
I can read this!
Connect to another node in the cluster and try to read the file from there.
$ ssh node2 $ hadoop fs -cat security-test.txt
You'll see the following line on the screen:
I can read this!
Log out from the other node.
$ exit
Create a home directory for another user and give them ownership...