# Access drone secrets in appleboy/drone-ssh script section

**URL:** <https://drone.discourse.group/t/access-drone-secrets-in-appleboy-drone-ssh-script-section/10652>\
**Category:** Drone Support\
**Created:** [April 20, 2019, 7:59am UTC](https://drone.discourse.group/t/access-drone-secrets-in-appleboy-drone-ssh-script-section/10652 "2019-04-20T07:59:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DNajjarzade](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/dnajjarzade/32/5185_2.png) [@DNajjarzade](https://drone.discourse.group/u/DNajjarzade)\
**Post date:** [April 20, 2019, 7:59am UTC](https://drone.discourse.group/t/access-drone-secrets-in-appleboy-drone-ssh-script-section/10652/1 "2019-04-20T07:59:08Z")

</div>

Greetings Dear community,  
These secrets [prod\_ssh\_username & prod\_ssh\_password] work and I can ssh into destination host so I think drone is working.  
but all my tries to get the bbp secret using in script section fail.

```auto
REPOSITORY TAG IMAGE ID
drone/drone 1 89752c9cb739
appleboy/drone-ssh latest 1858d153b41f

- name: prod
  image: appleboy/drone-ssh
  pull: always
  when:
    event:
      - push
    branch:
      - prod
  environment:
    bbp:
      from_secret: bbp
  settings:
    host: x.x.x.x
    port: 22
    username:
      from_secret: prod_ssh_username
    password: 
      from_secret: prod_ssh_password
    bbp:
      from_secret: bbp
    envs: [bbp]
    script:
      - cd /var/www/html/
      - echo $bbp
      - echo ${bbp}
      - echo $${bbp}

```

* * *

this is the drone output:

```auto

======CMD======
cd /var/www/html/
echo $bbp
echo 
echo ${bbp}
======END====== 
out:
out:
out:

```

I have rad all the toppics avilable.  
in other solved issues the variable (bbp in my case) is only defined below environment, and not in settings section, i have testet without the settings section too with no luck.  
what am I missing? Any help is appreciated.  
Thank you for your time.

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [April 20, 2019, 6:09pm UTC](https://drone.discourse.group/t/access-drone-secrets-in-appleboy-drone-ssh-script-section/10652/2 "2019-04-20T18:09:17Z")

</div>

I do not think you are missing anything … I do not think the plugin supports injecting secrets into the remote machine script. You would have to follow up with the plugin author to get more details [https://github.com/appleboy/drone-ssh](https://github.com/appleboy/drone-ssh)

---

<div class="post-metadata">

**Author:** ![DNajjarzade](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/dnajjarzade/32/5185_2.png) [@DNajjarzade](https://drone.discourse.group/u/DNajjarzade)\
**Post date:** [April 23, 2019, 7:42am UTC](https://drone.discourse.group/t/access-drone-secrets-in-appleboy-drone-ssh-script-section/10652/3 "2019-04-23T07:42:08Z")

</div>

Dear Brad

Thank you for your response,  
This is how i overcame this situation, following this solved issue:

> <https://github.com/appleboy/drone-ssh/issues/130>
>
> How to use secrets in script?
> Drone version 1.0.0-rc.1
> 
> \`\`\`
> ssh:
> image:… appleboy/drone-ssh
> host: host.com
> username: 
> from\_secret: ssh\_user
> password:
> from\_secret: ssh\_password
> port: 22
> script:
> - docker login -u ${DOCKER\_USER} -p ${DOCKER\_PASS} repo.com
> \`\`\`
> 
> Example from documentation does not work for version 1.0.0 rc.1

I created a test variable and could access the needed secret.  
I have no idea why my “bbp” variable did not get populated but the test variable was !!!

i have opened an issue on the appleboy/drone-ssh repository and hope to get some clearance.  
for now this issue is solved.
