How can I change the directory in which I land when accessing a computer via SSH?

0

I always enter the computer in this directory:

/cygdrive/c/Program Files/ICW/var

How can I change that?

systemovich

Posted 2011-02-22T10:44:12.817

Reputation: 1 017

Answers

1

What does echo ~ print after you have logged in?

I'm pretty sure that is your home directory, as defined in /etc/passwd inside your Cygwin environment.

So either:

  1. edit /etc/passwd and change the entry for your user to the directory you prefer (note that it might be overridden when you run mkpasswd)
  2. edit your shell configuration files to always do a cd automatically after logging in
    e.g. add cd <some other directory> to the bottom of your ~/.bashrc

One of those should do the trick.

If not, try this:

  • run env | find "var" and see which variables are printed
    perhaps %USERPROFILE% or %HOMEPATH% are set to that directory
    if so, Control Panel or net user /PROFILEPATH:<new dir> should help

or this:

  • run grep -R ICW /etc
    maybe something is hard-coded in /etc/profile or a similar startup script

Mikel

Posted 2011-02-22T10:44:12.817

Reputation: 7 890