在core-site.xml中加入如下属性
<property>
<name>hadoop.http.filter.initializers</name>
<value>org.apache.hadoop.security.AuthenticationFilterInitializer</value>
</property>
<property> <name>hadoop.http.authentication.signature.secret.file</name>
<value>hadoop-http-auth-signature-secret</value>
</property>
<property> <name>hadoop.http.authentication.simple.anonymous.allowed</name>
<value>false</value>
</property>
在hadoop 安装目录下新建hadoop-http-auth-signature-secret文件,注意<value>hadoop-http-auth-signature-secret</value>中可以写路径,这里面是相对路径,默认是在hadoop安装目录,hadoop-http-auth-signature-secret文件中写入hadoop,意思是可以使用hadoop这个用户来登陆hadoop的web,可以定义多个用户,用换行分隔