You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Terminal does not load user paths or env variables #226
Custom binary paths are not loading from the users .profile or /etc/profile on ubuntu. For example, I have go installed on the ubuntu machine. In my ~/.profile, I have the path to export PATH=$GOPATH/bin:$GOROOT/bin:$PATH. On a standard ssh terminal the go binary loads. The terminal in VSCode does not load any custom paths. I have to run source ~/.profile. This has to be done on each load of a new terminal.
Steps to Reproduce
go -- Output Command 'go' not found,
source ~/.profile
go version -- Output: go version go1.12 linux/amd64
systemd doesn't get your environment. You need to use the Environment or EnvironmentFile directives to set environment variables. Quick (probably foolish) hack would be to env > myenv then add EnvironmentFile=/path/to/myenv which would get the currently set environment variables. Beware, that might be a security risk.
@bketelsen thank you for the information. I assummed since the terminal in VSCode loaded with my username the envirnment would like like the desktop app.
Sorry to comment on such an old thread, but it's the closest I've found to a solution for myself. @bketelsen, could you expand on how someone using code-server as a system service could modify the daemon to use the user's environment?
Context: My instance of code-server is secured via an identity-aware proxy, so I'm not worried about the security risk. The values in my $PATH are different between the terminal in code-server and the one I get from an SSH session.
Activity
sr229 commentedon Mar 13, 2019
hey @tvarwig, was this running on your own user, yes?
tvarwig commentedon Mar 13, 2019
@sr229 Yes as a non root user
sr229 commentedon Mar 13, 2019
FWIW it should load that properly since its user shell bound. Was this in Docker or a bare installation?
tvarwig commentedon Mar 14, 2019
Bare installation with
systemdon Ubuntu 18.04. I have theUser=myusernameunderSystem. The terminal saysmysername@myhostname:.bketelsen commentedon Mar 14, 2019
systemd doesn't get your environment. You need to use the Environment or EnvironmentFile directives to set environment variables. Quick (probably foolish) hack would be to
env > myenvthen addEnvironmentFile=/path/to/myenvwhich would get the currently set environment variables. Beware, that might be a security risk.tvarwig commentedon Mar 15, 2019
@bketelsen thank you for the information. I assummed since the terminal in VSCode loaded with my username the envirnment would like like the desktop app.
alexfornuto commentedon Aug 9, 2021
Sorry to comment on such an old thread, but it's the closest I've found to a solution for myself. @bketelsen, could you expand on how someone using code-server as a system service could modify the daemon to use the user's environment?
Context: My instance of code-server is secured via an identity-aware proxy, so I'm not worried about the security risk. The values in my
$PATHare different between the terminal in code-server and the one I get from an SSH session.