# Adding Username to VM Context

**URL:** <https://forum.opennebula.io/t/adding-username-to-vm-context/9367>\
**Category:** Installation & Configuration\
**Created:** [April 6, 2021, 7:47pm UTC](https://forum.opennebula.io/t/adding-username-to-vm-context/9367 "2021-04-06T19:47:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mercwri](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/mercwri/32/6899_2.png) [@Mercwri](https://forum.opennebula.io/u/Mercwri)\
**Post date:** [April 6, 2021, 7:47pm UTC](https://forum.opennebula.io/t/adding-username-to-vm-context/9367/1 "2021-04-06T19:47:13Z")

</div>

I am try to understand how to apply a user to a VM Context. In my Context if I set USERNAME equal to a static value it will make that user. But I want it to take the Username of the user who is creating the VM, I have tried setting it $USER, $USERNAME, $USER[NAME], $USER[USERNAME] and the field remains blank when checking the VM’s context screen. What is the correct value for this?

---

<div class="post-metadata">

**Author:** ![sbetanzos](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/sbetanzos/32/6430_2.png) [@sbetanzos](https://forum.opennebula.io/u/sbetanzos)\
**Post date:** [April 7, 2021, 8:23am UTC](https://forum.opennebula.io/t/adding-username-to-vm-context/9367/2 "2021-04-07T08:23:22Z")

</div>

Hi @Mercwri ,

you are on the right track, but there is a detail. The attribute should be in the USER TEMPLATE

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/opennebula/original/2X/4/42851e7360962bd027f4f958cf5966ff972dccef.png)

**Other option** is add `$UNAME` to your context template, eg:

```auto
CONTEXT = [
  NETWORK = "YES",
  SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]",
  USERNAME = "$UNAME" ]

```

You can check [documentation](http://docs.opennebula.io/6.0/management_and_operations/references/template.html#context-section) for more information

Regards 🚀
