Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

curl command failing

avatar
Super Collaborator

my rest server is up and running and the following command works

[root@hadoop1 ~]# curl --negotiate -u : 'http://hadoop1:17001/status/cluster'
1 live servers, 0 dead servers, 6.0000 average load
1 live servers
    hadoop5.xxx.com:16020 1530282635984
        requests=0, regions=6
        heapSizeMB=145
        maxHeapSizeMB=2007

but the other curl commands are failing with authentication error . I have a Kerberos ticket acquired from

/etc/security/keytabs/hbase.service.keytab

[root@hadoop1 ~]# curl -H "Accept: text/xml" http://hadoop1:17001/version
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 401 Authentication required</title>
</head>
<body><h2>HTTP ERROR 401</h2>
<p>Problem accessing /version. Reason:
<pre>    Authentication required</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>                                           
<br/>

1 ACCEPTED SOLUTION

avatar
Super Guru

@Sami Ahmad,

You have to use negotiate for all the curl calls

curl --negotiate -u -H "Accept: text/xml" http://hadoop1:17001/version

View solution in original post

10 REPLIES 10

avatar
Super Collaborator

also this command works

# curl --negotiate -i -u : -X GET -H "Accept: text/xml" http://$(hostname):17001/
HTTP/1.1 401 Authentication required
WWW-Authenticate: Negotiate
Set-Cookie: hadoop.auth=; Path=/; HttpOnly
Content-Type: text/html; charset=iso-8859-1
Cache-Control: must-revalidate,no-cache,no-store
Content-Length: 1393
HTTP/1.1 200 OK
Set-Cookie: hadoop.auth="u=hbase&p=hbase/hadoop1.xxx.com@XXX.US&t=kerberos&e=1530321348642&s=D797P7EN3+vVCB0S2WblChieQrs="; Path=/; HttpOnly
Content-Type: text/xml
Cache-Control: no-cache
Content-Length: 141
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><TableList><table name="UFM"/><table name="WZ"/><table name="state_code"/></TableList>[root@hadoop1 ~]#

but this command fails

# curl -H "Accept: text/xml" http://$(hostname):17001/
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 401 Authentication required</title>
</head>
<body><h2>HTTP ERROR 401</h2>
<p>Problem accessing /. Reason:
<pre>    Authentication required</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>                                           
<br/>