Database Reference
In-Depth Information
•
Write (
w
) permission
: An account has permission to change or
modify the file or folder.
•
Execute (
x
) permission
: An account can enumerate the contents of a
directory. This permission applies to directories only.
To modify the permissions applied to a file, you can use the
chmod
command. To add permissions, use the plus (
+
) sign followed by the
appropriate permission letters. For example, to give all users read/write
permissions to the
SampleData_4.txt
file, you use the following
command:
hadoop dfs -chmod +rw /user/MSBigDataSolutions/
SampleData_4.txt
To remove the permissions, use the minus (
-
) sign:
hadoop dfs -chmod -rw /user/MSBigDataSolutions/
SampleData_4.txt
To control which user the permissions apply to, you can prefix the
permission with
u
,
g
, or
o
, which respectively stand for the user who owns
the file, the group assigned to the file, or all other users. The following
command adds read/write permissions back, but only to the owner of the
file:
hadoop dfs -chmod u+rw /user/MSBigDataSolutions/
SampleData_4.txt
You can modify the owner and group associated with a file or directory by
using
chown
and
chgrp
, respectively. To change the owner, you must be
running the command as the super-user account:
hadoop dfs -chown NewOwner /user/MSBigDataSolutions/
SampleData_4.txt
To change the group associated with a file or a directory, you must be either
the current owner or the super user:
hadoop dfs -chgrp NewGroup /user/MSBigDataSolutions/
SampleData_4.txt