Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to add a directory to my PATH environment so I can run some commands remotely. I have set this in my .bashrc, .tcshrc as well as in /etc/profile and /etc/csh.login but whenever I check my path remotely via SSH it is not in my path. When I log in, from the shell I have

>/usr/bin/env | grep PATH
PATH=/usr/bin:/usr/local/bin:/path/I/just/added

but remotely:

SSH hostname "/usr/bin/env| grep PATH" PATH=/usr/bin

I seem to remember something about a difference between login shells and interactive shells. Where do I set environment variables so they hold for all shells.

share|improve this question

migrated from serverfault.com Aug 11 '11 at 15:50

This question came from our site for professional system and network administrators.

add comment

1 Answer

  1. Change PermitUserEnvironment to yes in /etc/ssh/sshd_config and restart sshd.
  2. Define a PATH in /home/user/.ssh/environment on the ssh server, e.g.

    PATH=/usr/lib64/qt-3.3/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin
    
share|improve this answer
    
That worked. Don't have enough reputation points to vote up your answer so thanks is all I have for now. –  JavaDev Aug 11 '11 at 16:48
    
@JavaDev: If an answer has solved your problem, mark it as accepted. –  grawity Aug 11 '11 at 18:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.