Pages

Monday, February 26, 2018

[curl] OpenBMC User

List User Objects
[curl]
curl -b cjar -k https://${bmc_ip}/xyz/openbmc_project/user/list

For example
[curl in Linux]
$ curl -b cjar -k https://192.168.88.38/xyz/openbmc_project/user/list
{
  "data": [
    "/xyz/openbmc_project/user/root"
  ],
  "message": "200 OK",
  "status": "ok"
}


Enumerate of User
[curl]
curl -b cjar -k https://${bmc_ip}/xyz/openbmc_project/user/enumerate

For example
[curl in Linux]
$ curl -b cjar -k https://192.168.88.38/xyz/openbmc_project/user/enumerate
{
  "data": {
    "/xyz/openbmc_project/user/root": {}
  },
  "message": "200 OK",
  "status": "ok"
}


Change Password of root
[curl]
curl -c cjar -b cjar -k -H "Content-Type: application/json" -d "{\"data\": [\"<PASSWORD>\"] }" -X POST https://${bmc_ip}/xyz/openbmc_project/user/root/action/SetPassword

For example
[curl in Linux]
$ curl -c cjar -b cjar -k -H "Content-Type: application/json" -d "{\"data\": [\"cc617\"] }" -X POST http://192.168.88.38/xyz/openbmc_project/user/root/action/SetPassword
{
  "data": null,
  "message": "200 OK",
  "status": "ok"
}
$ curl -c cjar -k -X POST -H "Content-Type: application/json" -d '{"data": [ "root","0penBmc" ] }' https://192.168.88.38/login
{
  "data": {
    "description": "Invalid username or password"
  },
  "message": "200 OK",
  "status": "ok"
}
$ curl -c cjar -k -X POST -H "Content-Type: application/json" -d '{"data": [ "root","cc617" ] }' https://192.168.88.38/login
{
  "data": "User 'root' logged in",
  "message": "200 OK",
  "status": "ok"
}




Last Updated: 26-02-2018

No comments:

Post a Comment