How can I change the users home directory in bamboo ?
Asked by Hector Magnanao:

When I look at the properties of my remote agent, the users home directory is being set to C:\\Users\\TEMP. Is there a way to set it to the C:\\Users\\\<user running bamboo\> ?

I'm referring to the users home directory. Not the bamboo build directory.


Answers:
author: rsperafico
body: Hi [@Hector Magnanao](/t5/user/viewprofilepage/user-id/1048131),

If you already have a remote agent running, you could:

1. stop Bamboo remote agent
2. edit \<bamboo-remote-home\>/conf/wrapper.conf and update property to point to the chosen location in filesystem:

   ```
   wrapper.java.additional.1=-Dbamboo.home=C:\Users\TEMP
   ```

3. copy \<bamboo-remote-home\> to the location specified above
4. start Bamboo remote agent

If you are installing a new remote agent, you can provide \<bamboo-remote-home\> directory in java command:

```
java -Dbamboo.home=/path/to/bamboo-remote-home -jar atlassian-bamboo-agent-installer-X.X-SNAPSHOT.jar http://bamboo-host-server:8085/agentServer/
```

Please, refer to the following documentation for further information:

* <https://confluence.atlassian.com/bamboo/bamboo-remote-agent-installation-guide-289276832.html>
* <https://confluence.atlassian.com/bamboo/additional-remote-agent-options-436044733.html>

Note: User running Bamboo remote agent must have full access to the directory specified.

Kind regards,

Rafael

comments: author: Hector Magnanao
body: Hi Rafael,

the bamboo home directory is set correctly. It's the bamboo users home directory that is being set to C:\\Users\\TEMP. It should be set to C:\\Users\\\<bamboo account\>

This is causing the builds to fail because it can't find the settings.xml file in the correct folder. I can't use the current directory because it might be removed one day.


author: Hector Magnanao
body: The system properties of the bamboo agent is attached. The problem is circled in red.

![bamboo_sysproperties.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/19340i41D47C76237FDBBC/image-size/large?v=v2&px=999 "bamboo_sysproperties.PNG")


author: rsperafico
body: Hi [@Hector Magnanao](/t5/user/viewprofilepage/user-id/1048131),

That is the temp directory and you can updated it by:

1. stop Bamboo remote agent
2. edit \<bamboo-remote-home\>/conf/wrapper.conf and update property to point to the chosen location in filesystem:

   ```
   wrapper.java.additional.X=-Djava.io.tmpdir=C:\Users\TEMP
   ```

   where .X is the following number in sequence
3. copy \<bamboo-remote-home\> to the location specified above
4. start Bamboo remote agent

Kind regards,

Rafael


author: Hector Magnanao
body: Hi Rafael,

When I tried to set that variable to C:\\Users\\3_bamboo in the wrapper.conf file, the User Home is being set to C:\\

I would like to set User Home in that window to C:\\Users\\3_bamboo

I believe that if I can set the User Home to this value, then the temporary directory will also be set correctly.

How do I set the User Home directory in that conf file ?


author: rsperafico
body: Hi [@Hector Magnanao](/t5/user/viewprofilepage/user-id/1048131),

Could you share wrapper.conf displaying all wrapper.java.additional properties?  

What is the output for Temporary directory?

What is the user running Bamboo remote agent? If running as a Windows Service, please run using Local user instead of System.

What is the output of command from CMD?  

```
echo %homepath%
```

Kind regards,

Rafael


author: Hector Magnanao
body: Hi [@rsperafico](/t5/user/viewprofilepage/user-id/781554)

**contents of wrapper.conf (default content):**

# The Bamboo Agent home configuration file  
wrapper.java.additional.1=-Dbamboo.home="D:\\bamboo-agent-home"  
wrapper.java.additional.2=-Dbamboo.agent.ignoreServerCertName=false  
#wrapper.java.additional.3=-Dlog4j.configuration=  
#wrapper.java.additional.3=-agentlib:yjpagent

**output for temporary directory:**

Temporary directoryC:\\Users\\TEMP\\AppData\\Local\\Temp\\

the user running Bamboo remote agent is 3_bamboo. This is the service account that we need to run in bamboo.

Unfortunately we are not allowed to login directly into the bamboo agent as a service account. I can only login as myself. so echo %homepath%

C:\\Users\\i842625\>echo %homepath%  
\\Users\\i842625


author: rsperafico
body: Hi [@Hector Magnanao](/t5/user/viewprofilepage/user-id/1048131),

In the same way Bamboo gets the temporary directory, e.g:

```
tempDir = sysProps.getProperty("java.io.tmpdir");
```

You could try and set up a new user home directory by providing "-Duser.home" as property that should be read by Bamboo from:

```
userHome = sysProps.getProperty("user.home");
```

So wrapper.conf should be:

```
# The Bamboo Agent home configuration file
wrapper.java.additional.1=-Dbamboo.home="D:\bamboo-agent-home"
wrapper.java.additional.2=-Dbamboo.agent.ignoreServerCertName=false
wrapper.java.additional.3=-Duser.home="C:\Users\<user running bamboo>"
#wrapper.java.additional.3=-Dlog4j.configuration=
#wrapper.java.additional.3=-agentlib:yjpagent
```

Kind regards,

Rafael


author: Hector Magnanao
body: Rafael

Where do I set this variable in ?

```
userHome = sysProps.getProperty("user.home");?
```


author: rsperafico
body: Hi [@Hector Magnanao](/t5/user/viewprofilepage/user-id/1048131),

You don't, simply add the property *-Duser.home* to *wrapper.conf* as mentioned previously.

```
# The Bamboo Agent home configuration file
wrapper.java.additional.1=-Dbamboo.home="D:\bamboo-agent-home"
wrapper.java.additional.2=-Dbamboo.agent.ignoreServerCertName=false
wrapper.java.additional.3=-Duser.home="C:\Users\<user running bamboo>"
#wrapper.java.additional.3=-Dlog4j.configuration=
#wrapper.java.additional.3=-agentlib:yjpagent
```

Note: Bamboo remote agent must be restarted so changes can be applied.

Kind regards,

Rafael


author: Hector Magnanao
body: Hi [@rsperafico](/t5/user/viewprofilepage/user-id/781554)

Ok, so that worked. I see that the user home directory is now set correctly.

But, it looks like C:\\Users\\temp is still being used by the build. It appears that way because the repository is being created under C:\\Users\\Temp.

Any ideas why this is happening ?


author: rsperafico
body: Hi [@Hector Magnanao](/t5/user/viewprofilepage/user-id/1048131),
> It appears that way because the repository is being created under C:\\Users\\Temp.

Are you referring to the repository caching? What is the content of C:\\Users\\temp?

Kind regards,

Rafael


author: Hector Magnanao
body: Hi [@rsperafico](/t5/user/viewprofilepage/user-id/781554)

Yes. The content is .m2, settings files and the repository folders in it.


author: rsperafico
body: Hi [@Hector Magnanao](/t5/user/viewprofilepage/user-id/1048131),

Please, raise a support case under <https://support.atlassian.com> so information related to directory and build logs can be shared.

Kind regards,

Rafael