The exact syntax for setting an environment variable may be different if your shell is not bash.
## It doesn't work when I'm root
You have to install shell integration in root's login script, too. I bet you don't like that idea.
There is a workaround. You can define a trigger to tell iTerm2 what your username and hostname are for times when installing shell integration is not an option. Define a trigger that fires when you become root. Set the action to *Set User & Host*. Set the parameter to `root@example.com` (replacing *example.com* with your hostname, of course).
## Is something else up?
Informative logs are written to `/var/log/system.log` when you use iTerm2's secure copy feature. Have a look at what is written there to get a clue of what else might be going on. If you file an issue, please include this information.