1

I have an Windows 2008 Server Instance running on EC2. I have installed an application and added it to the path and it is now available to my Administrator user from the Command Line.

However, when I SSH in to the server as the Admin User, the command is no longer available. If I $echo %path% I cannot see the path to the application I have added.

So it seems that when the same user connects via SSH, a different path is used. But where is this path? Is there a windows equivillant of bashrc that is being loaded instead of the path?

I'm using FreeSSH for the SSH server.

Undistraction
  • 117
  • 2
  • 6
  • What SSH server are you using? Sounds like a problem with the SSH server. – Zoredache Jan 10 '13 at 17:30
  • @Zoredache I'm using FreeSSHd. If I check the path I can see the app is referenced, so there must be somewhere else that a path can be loaded from for the user when they access via SSH. – Undistraction Jan 10 '13 at 17:35
  • Did you add it to the System path or the User path? Your SSH server might not be loading the one you expect. I've only used CopSSH in a Windows environment so I can't speak for FreeSSHd. – ceskib Jan 10 '13 at 17:45

1 Answers1

3

In Windows, %PATH% is generally loaded when an application or service starts, so you'll need to restart your SSH Server after making the change.

Windows also has two path variables, one global, and one per user, so you have to be careful to modify the right one, to get it working as expected.

To further complicate matters, the method of setting the path environmental variable that I see rise to the top with Google (set) is wrong - "Changes made with SET will remain only for the duration of the current CMD session."

The method I've always used, and yet to have problems with, is the setx command. Follow that with a restart of your SSH server service and you should be good to go.

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
  • @1ndivisible To your bit about OSX, changing global variables in Windows requires a logout (or reboot) for any user's session to pickup the change - so if you're using SSH to allow OSX users to connect to persistent login, they'll have to relog to see the changes (or reboot the server, to do that for them.) – HopelessN00b Jan 10 '13 at 18:14
  • How would I use setx tin this situation? I just want to add a path to the path, not a key/value variable? – Undistraction Jan 10 '13 at 18:19
  • @1ndivisible [I couldn't find a good "how do I append something to %PATH%" answer, so I made one.](http://serverfault.com/q/465924/118258) – HopelessN00b Jan 10 '13 at 18:51