# Ssh\_keydir is not configured

**URL:** <https://dmap-community.ductus.global/t/ssh-keydir-is-not-configured/4096>\
**Category:** CDB and CDB API\
**Created:** [May 31, 2022, 1:48pm UTC](https://dmap-community.ductus.global/t/ssh-keydir-is-not-configured/4096 "2022-05-31T13:48:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![furkan](https://avatars.discourse-cdn.com/v4/letter/f/278dde/32.png) [@furkan](https://dmap-community.ductus.global/u/furkan)\
**Post date:** [May 31, 2022, 1:48pm UTC](https://dmap-community.ductus.global/t/ssh-keydir-is-not-configured/4096/1 "2022-05-31T13:48:19Z")

</div>

Hi,

I’ve been trying to create user with a maapi as shown in confd user guide but I am getting error as below;

TRACE MAAPI\_CD /aaa/authentication/users → CONFD\_OK  
2022-05-31T13:48:12.928467113Z TRACE MAAPI\_CREATE user{furkank} → CONFD\_OK  
2022-05-31T13:48:12.936511166Z TRACE MAAPI\_APPLY\_TRANS DEBUG notset - **/aaa:aaa/authentication/users/user{furkank}/ssh\_keydir is not configured**  
2022-05-31T13:48:12.936542422Z → CONFD\_ERR  
2022-05-31T13:48:12.937015729Z TRACE MAAPI\_STOP\_TRANS → CONFD\_OK

Saying ssh\_keydir is not set. My code is below.

> ```
> sprintf(sshkeydir,"var/confd/home/%s/.ssh",userName);
> sprintf(homedir,"home/%s",userName);
> if (maapi_cd(msock,th,"/aaa/authentication/users") != CONFD_OK)
> confd_fatal("cannot CD: %s", confd_lasterr());
> if (maapi_create(msock,th,"user{%s}",userName) != CONFD_OK)
> {
> if (maapi_set_elem2(msock,th,sshkeydir,"/aaa/authentication/users/user{%s}/ssh_keydir",userName) != CONFD_OK)
> {
> confd_fatal("failed to set ssh keydir: %s\n", confd_lasterr());
> printf("Could not create user %s \n",userName);
> }
> if (maapi_set_elem2(msock,th,"","/aaa/authentication/users/user{%s}/password",userName) != CONFD_OK)
> {
> printf("Could not create user %s \n",userName);
> 
> }
> if (maapi_set_elem2(msock,th,homedir,"/aaa/authentication/users/user{%s}/homedir",userName) != CONFD_OK)
> {
> confd_fatal("failed to set homedir: %s\n", confd_lasterr());
> printf("Could not create user %s \n",userName);
> }
> }
> 
> ```

Thanks in advance

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [May 31, 2022, 3:45pm UTC](https://dmap-community.ductus.global/t/ssh-keydir-is-not-configured/4096/2 "2022-05-31T15:45:05Z")

</div>

> [@furkan](#):
>
> ```auto
> if (maapi_create(msock,th,"user{%s}",userName) != CONFD_OK)
> {
> ...
> 
> ```

I believe you want the `!=` to be `==` so that if creating the “user” list entry succeeds you set the leafs for that list entry.
