What happens if we share same user among multiple users?
If we share same hadoop user account among multiple users then we suffer from following problems
- Difficult to trace the jobs and track the tasks/defects done by each user
- Shared account arriase security issue.
- If all are given the same user account, all users will have the same privilege and all can
access everyone’s data, can modify it, can perform execution, can delete it also.
What are the benefits of creating multiple users?
- The directories/files of one user cannot be modified by other user.
- Other users cannot add new files to a user’s directory.
- Other users cannot perform any tasks (mapreduce etc) on a user’s files.
Steps for setting up multiple User Accounts
 Create a New User
Ubuntu: $ sudo adduser --ingroup <groupname> <username> Redhat: $ useradd -g <groupname> <username> All: $ passwd <username>
 Chanage permission of hadoop temp directory
Change the permission of a directory in HDFS where hadoop stores its temporary data.
Find that directory by looking entry
Then from the superuser account do the following step.
$ hadoop fs –chmod -R 1777 /path/to/hadoop/tmp/directory
 Give write access to hadoop temp directory in user machine
The next step is to give write permission to our user group on
core-site.xml to get the path for
hadoop.tmp.dir. This should be done only in the machine(node) where the new user is added.
$ chmod 777 /path/to/hadoop/tmp/dirctory
 Create user home directory in HDFS
The next step is to create a directory structure in HDFS for the new user.
For that from the superuser, create a directory structure.
$ hadoop fs –mkdir /user/username/
 Change the ownership of user home directory in HDFS
The ownership of the newly created directory structure is with superuser.With this new user
will not be able to run mapreduce programs. So change the ownership of newly created directory in HDFS to the new user.
$ hadoop fs –chown –R username:groupname <directory to access in HDFS> Eg: hadoop fs –chown –R username:groupname /user/username/
 Now run jobs with new user
Login with new user and run jobs
$ su - newuser $ bin/hadoop jar pathToJar.jar mainClass input/path output/path