Skip to content

Terminal does not load user paths or env variables #226

Closed

Description

@tvarwig
  • 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

Activity

  1. sr229 commented on Mar 13, 2019

    @sr229
    Contributor

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

  2. tvarwig commented on Mar 13, 2019

    @tvarwig
    Author

    @sr229 Yes as a non root user

  3. sr229 commented on Mar 13, 2019

    @sr229
    Contributor

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

  4. tvarwig commented on Mar 14, 2019

    @tvarwig
    Author

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

  5. bketelsen commented on Mar 14, 2019

    @bketelsen

    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.

  6. tvarwig commented on Mar 15, 2019

    @tvarwig
    Author

    @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.

  7. alexfornuto commented on Aug 9, 2021

    @alexfornuto

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions