Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminal does not load user paths or env variables #226

Closed
tvarwig opened this issue Mar 13, 2019 · 7 comments
Closed

Terminal does not load user paths or env variables #226

tvarwig opened this issue Mar 13, 2019 · 7 comments
Labels
bug Something isn't working

Comments

@tvarwig
Copy link

tvarwig commented Mar 13, 2019

  • code-server version:1.32.0-245
  • OS Version: Ubuntu 18.04

Description

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

  1. go -- Output Command 'go' not found,
  2. source ~/.profile
  3. go version -- Output: go version go1.12 linux/amd64
@tvarwig tvarwig added the bug Something isn't working label Mar 13, 2019
@sr229
Copy link
Contributor

sr229 commented Mar 13, 2019

hey @tvarwig, was this running on your own user, yes?

@tvarwig
Copy link
Author

tvarwig commented Mar 13, 2019

@sr229 Yes as a non root user

@sr229
Copy link
Contributor

sr229 commented Mar 13, 2019

FWIW it should load that properly since its user shell bound. Was this in Docker or a bare installation?

@tvarwig
Copy link
Author

tvarwig commented Mar 14, 2019

Bare installation with systemd on Ubuntu 18.04. I have the User=myusername under System. The terminal says mysername@myhostname:.

@bketelsen
Copy link

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.

@tvarwig
Copy link
Author

tvarwig commented 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.

@tvarwig tvarwig closed this as completed Mar 18, 2019
@alexfornuto
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants