# Confd\_cli interactive mode in script

**URL:** <https://dmap-community.ductus.global/t/confd-cli-interactive-mode-in-script/3247>\
**Category:** CDB and CDB API\
**Created:** [August 27, 2020, 10:22pm UTC](https://dmap-community.ductus.global/t/confd-cli-interactive-mode-in-script/3247 "2020-08-27T22:22:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sumeet](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@Sumeet](https://dmap-community.ductus.global/u/Sumeet)\
**Post date:** [August 27, 2020, 10:22pm UTC](https://dmap-community.ductus.global/t/confd-cli-interactive-mode-in-script/3247/1 "2020-08-27T22:22:03Z")

</div>

We have enable mode which asks for password. How can i provide password if doing it via script?  
Here is the script referred from user guide:

```auto
#!/bin/sh
/usr/local/bin/confd_cli -u admin -U 1000 -g admin -n -v -C<< EOF
enable
configure
set foo bar 13
set funky stuff 44
commit
#exit no-confirm
exit
EOF

```

It connects and does not prompt for password. Like:

```
localhost> enable
Password:
% Bad password
localhost> set foo bar 13
...
...

```

Thanks.

---

<div class="post-metadata">

**Author:** ![mvf](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mvf/32/182_2.png) [@mvf](https://dmap-community.ductus.global/u/mvf)\
**Post date:** [August 28, 2020, 8:36am UTC](https://dmap-community.ductus.global/t/confd-cli-interactive-mode-in-script/3247/2 "2020-08-28T08:36:12Z")

</div>

Is it really necessary that you interact with ConfD using a shell script talking to confd\_cli, and in particular using the IOS style? Of all possible options ordered by usability this one would likely rank somewhere near the end. The example in the UG shows how you can, quoting, “ **test** various aspects of the CLI” (emphasis mine); it is not meant as a method for deployment.

If you (your client) are for some reason restricted to bash or sh scripts, consider providing NETCONF/RESTCONF, even that would provide better experience using tools like netconf-console or curl; if you are for some reason restricted to confd\_cli, you might want to consider tools like `expect` or the Python library `pexpect` or variants - these are specifically designed to interact with CLIs.

---

<div class="post-metadata">

**Author:** ![josephm](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@josephm](https://dmap-community.ductus.global/u/josephm)\
**Post date:** [August 28, 2020, 8:41am UTC](https://dmap-community.ductus.global/t/confd-cli-interactive-mode-in-script/3247/3 "2020-08-28T08:41:14Z")

</div>

As a workaround, you could (depending on your requirements):

- just disable config password for CLI user

or

- create new CLI user without config password for scripting, do you don’t affect your current user
