Hadoop SSH Key Authentication Setup
In Hadoop, user authentication for login can be achieved by configuring SSH keys. Here are the configuration steps:
- Generate key pair: Run the following command on the host machine of the user you want to use.
ssh-keygen -t rsa
Following the prompts, the generated key pair will be stored in the user’s home directory in the .ssh folder as id_rsa and id_rsa.pub.
- keys that have been given permission
- public key file
- key authorization
cat id_rsa.pub >> ~/.ssh/authorized_keys
- Secure Shell (SSH)
ssh user@hadoop-node
- Set up Hadoop services by adding or modifying the following configuration settings in the Hadoop configuration files to enable SSH key authentication for login.
Add the following in core-site.xml:
<property>
<name>hadoop.security.authentication</name>
<value>publickey</value>
</property>
Add the following to the hdfs-site.xml:
<property>
<name>dfs.block.access.token.enable</name>
<value>true</value>
</property>
- Restarting the Hadoop service: Restarting the Hadoop service to activate the configurations.
sbin/stop-all.sh
sbin/start-all.sh
Now you can login to the Hadoop cluster nodes using SSH key authentication.