PowerShell / PowerShell/Win32-OpenSSH

SSH, SFTP Not following user's home directory

Open
#154 15 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0 - Backlog Issue-Bug
Dominant language
No language data
Stars
8.3k
Forks
819
PR merge metrics
No merged PRs in 30d

Description

Good afternoon,

  • I'm new to using OpenSSH, so possibly this is user error, but it seems ssh/sftp are not following the home directory of the windows user. From what I've found, ChrootDirectory is not applicable in Win32, and the user home must be used. I created a local user of 'test2', set the home directory (in user config) to \test2home, and restarted SSHD.

If I connect to server through ssh or sftp (using user/pass), the default/home directory is c:\users\test2.

  • within SSH echo %HOME% returns c:\Users\test2, and echo %HOMEPATH% returns \Users\test2

If I log into the server locally and opening a cmd prompt, the default directory/home directory is c:\test2home.

  • within local windows cmd window echo %HOME% returns %HOME% and echo %HOMEPATH% returns \test2home.
  • So it seems to me windows is correctly handling the home path which was set, but Win32-OpenSSH is not. Due to needing to lock a remote user access down to a single 'empty' folder for sftp only for file exchanges, I need to use a 'nonstandard' home folder.
  • This is being used on Win Server 2008 R2.
  • Any pointers if I'm doing something wrong, or correcting the issue would be great!

Thanks,
~Tim

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by reproducing the SSH and SFTP login on Windows Server 2008 R2 and compare the configured home directory with the remote working directory and environment variables. Done means remote sessions use the configured nonstandard home folder, or the issue documents the platform limitation and its required configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.