Use following curl command to request a directory listing from HDFS while passing in the expected header SM_USER, note that the example is specific to sandbox:
curl -k -i --header "SM_USER: guest" -v 'https://localhost:8443/gateway/sandbox/webhdfs/v1/tmp?op=LISTSTATUS'
Omitting
the –header “SM_USER: guest”
above results in a HTTP status 401
unauthorized.