HDP on Linux – Installation Forum

Hadoop HDP 2.0 sshfence (Permission denied)

  • #47161
    Jakub Stransky

    I am trying Hadoop 2 High Availability for HDFS. I set up passwordless ssh connection among NameNodes under user hafence. That I verified – and it works. However I am getting following (Permission Denied) when using this sshfence setup.

    2014-01-20 12:54:47,101 INFO ha.NodeFencer (NodeFencer.java:fence(91)) – ====== Beginning Service Fencing Process… ======
    2014-01-20 12:54:47,101 INFO ha.NodeFencer (NodeFencer.java:fence(94)) – Trying method 1/1: org.apache.hadoop.ha.SshFenceByTcpPort(hafence:22)
    2014-01-20 12:54:47,101 WARN ha.SshFenceByTcpPort (SshFenceByTcpPort.java:tryFence(93)) – Unable to create SSH session
    com.jcraft.jsch.JSchException: java.io.FileNotFoundException: /home/hafence/.ssh/id_rsa (Permission denied)
    at com.jcraft.jsch.IdentityFile.newInstance(IdentityFile.java:98)
    at com.jcraft.jsch.JSch.addIdentity(JSch.java:206)
    at com.jcraft.jsch.JSch.addIdentity(JSch.java:192)
    at org.apache.hadoop.ha.SshFenceByTcpPort.createSession(SshFenceByTcpPort.java:122)
    at org.apache.hadoop.ha.SshFenceByTcpPort.tryFence(SshFenceByTcpPort.java:91)
    at org.apache.hadoop.ha.NodeFencer.fence(NodeFencer.java:97)
    at org.apache.hadoop.ha.ZKFailoverController.doFence(ZKFailoverController.java:521)
    at org.apache.hadoop.ha.ZKFailoverController.fenceOldActive(ZKFailoverController.java:494)
    at org.apache.hadoop.ha.ZKFailoverController.access$1100(ZKFailoverController.java:59)
    at org.apache.hadoop.ha.ZKFailoverController$ElectorCallbacks.fenceOldActive(ZKFailoverController.java:837)
    at org.apache.hadoop.ha.ActiveStandbyElector.fenceOldActive(ActiveStandbyElector.java:900)
    at org.apache.hadoop.ha.ActiveStandbyElector.becomeActive(ActiveStandbyElector.java:799)
    at org.apache.hadoop.ha.ActiveStandbyElector.processResult(ActiveStandbyElector.java:415)
    at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:596)
    at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:495)
    Caused by: java.io.FileNotFoundException: /home/hafence/.ssh/id_rsa (Permission denied)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at java.io.FileInputStream.<init>(FileInputStream.java:97)
    at com.jcraft.jsch.IdentityFile.newInstance(IdentityFile.java:83)
    … 14 more
    My configuration is as following in hdfs-site.xml:


    What are the permission requirements, user etc. in order to make the sshfence working?

to create new topics or reply. | New User Registration

  • Author
  • #47162

    Hi Jakub,

    Did you change the permissions correctly on your ssh keys?
    You will also need to check /home/hafence/.ssh

    chmod 644 .ssh/authorized_keys

    chmod 755 .ssh



    Jakub Stransky

    Hi Dave,

    when I set a different permissions (e.g. 755 as you suggest) linux sshd refuse the authentication an insist on 600 because of keys. I solved this problem by using a hdfs user


    Hi Jakub,

    .ssh should be the directory (755) with 644 being the authorized keys (when you setup the passwordless ssh)

    I’m glad you got it sorted out.



You must be to reply to this topic. | Create Account

Support from the Experts

A HDP Support Subscription connects you experts with deep experience running Apache Hadoop in production, at-scale on the most demanding workloads.

Enterprise Support »

Become HDP Certified

Real world training designed by the core architects of Hadoop. Scenario-based training courses are available in-classroom or online from anywhere in the world

Training »

Hortonworks Data Platform
The Hortonworks Data Platform is a 100% open source distribution of Apache Hadoop that is truly enterprise grade having been built, tested and hardened with enterprise rigor.
Get started with Sandbox
Hortonworks Sandbox is a self-contained virtual machine with Apache Hadoop pre-configured alongside a set of hands-on, step-by-step Hadoop tutorials.
Modern Data Architecture
Tackle the challenges of big data. Hadoop integrates with existing EDW, RDBMS and MPP systems to deliver lower cost, higher capacity infrastructure.