# Unable to get camera connection for root users \[Ubuntu 18.04\], LoadImageFile, CVB2019

**URL:** <https://forum.commonvisionblox.com/t/unable-to-get-camera-connection-for-root-users-ubuntu-18-04-loadimagefile-cvb2019/1348>\
**Category:** C-style API\
**Tags:** genicam\
**Created:** [February 17, 2021, 12:15pm UTC](https://forum.commonvisionblox.com/t/unable-to-get-camera-connection-for-root-users-ubuntu-18-04-loadimagefile-cvb2019/1348 "2021-02-17T12:15:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmolero](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@mmolero](https://forum.commonvisionblox.com/u/mmolero)\
**Post date:** [February 17, 2021, 12:15pm UTC](https://forum.commonvisionblox.com/t/unable-to-get-camera-connection-for-root-users-ubuntu-18-04-loadimagefile-cvb2019/1348/1 "2021-02-17T12:15:49Z")

</div>

Hi All

I’m capable to run the c api with no issues however when I’m trying to run it with root privileges I’m stuck in the LoadImageFile function which always returns false.

for example:

```auto
    CvbHelperBase* cvbHelper = nullptr;

    const size_t SIZE = 256;
    char fileNamePath[SIZE] = { 0 };
    if (!TranslateFileName("/opt/cvb/drivers/GenICam.vin", fileNamePath, SIZE)){
       return cvbHelper;
    }

    IMG img = nullptr;
    if (!LoadImageFile(fileNamePath, img)){
        return cvbHelper;
    }

   //continue the code

```

The above it does work with normal user, but no for root. I need to run my app as a root user. Does anyone know how I can deal with this issue?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![parsd](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/parsd/32/7_2.png) [@parsd](https://forum.commonvisionblox.com/u/parsd)\
**Post date:** [February 17, 2021, 6:47pm UTC](https://forum.commonvisionblox.com/t/unable-to-get-camera-connection-for-root-users-ubuntu-18-04-loadimagefile-cvb2019/1348/2 "2021-02-17T18:47:00Z")

</div>

Hi @mmolero, I think this should be the environment variables. In admin mode we only propagate a minimal set for configuration.

In general we advise against running as admin. But I can look up the file to change tomorrow.

---

<div class="post-metadata">

**Author:** ![mmolero](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@mmolero](https://forum.commonvisionblox.com/u/mmolero)\
**Post date:** [February 18, 2021, 8:45am UTC](https://forum.commonvisionblox.com/t/unable-to-get-camera-connection-for-root-users-ubuntu-18-04-loadimagefile-cvb2019/1348/3 "2021-02-18T08:45:06Z")

</div>

Thanks, it is right!

If we add

```auto
LD_LIBRARY_PATH=CVB=/opt/cvb,GENICAM_GENTL64_PATH=/opt/cvb/drivers/genicam,CVGENICAM_REGISTRY=/var/opt/cvb/Registry,VTE_VERSION=5202,IM_CONFIG_PHASE=2,GENICAM_CACHE_V3_1=/var/opt/cvb/genicam,CVBDATA=/var/opt/cvb,CVBCONFIG=/etc/opt/cvb

```

it is working now.

Thanks!
