reg
query
command to query the value for SFTPRootDir
in the Windows Registry or the reg add
command to change
the value, which is stored in SFTPRootDir
under
HKEY_LOCAL_MACHINE\SOFTWARE\nsoftware\PowerShellServer
.
Checking the location for SFTPRootDir:
C:\>reg query HKEY_LOCAL_MACHINE\SOFTWARE\nsoftware\PowerShellServer /v SFTPRootDir HKEY_LOCAL_MACHINE\SOFTWARE\nsoftware\PowerShellServer SFTPRootDir REG_SZ C:\Program Files\SSH\PowerShell Server V6\sftproot
If I wanted to change the location to C:\Users\Public\Documents
to allow all user accounts access to read and write files to the directory via
SFTP, I could use the reg add
command below:
C:\>reg add HKEY_LOCAL_MACHINE\SOFTWARE\nsoftware\PowerShellServer /v SFTPRootDir /t REG_SZ /d C:\Users\Public\Documents Value SFTPRootDir exists, overwrite(Yes/No)? yes The operation completed successfully.
If you don't want to be prompted as to whether you really want to make
the change you can add the /f
argument to force overwriting
the existing registry entry without a prompt asking you if you want to
overwrite it, e.g., reg add
HKEY_LOCAL_MACHINE\SOFTWARE\nsoftware\PowerShellServer /v SFTPRootDir /t
REG_SZ /d C:\Users\Public\Documents /f
.
If you change the location by directly altering the registry value, the
GUI will still show
the default location even if you restart the SSH/SFTP service by clicking
on the Restart option. You can verify that the new value was set with
the reg query
command:
C:\>reg query HKEY_LOCAL_MACHINE\SOFTWARE\nsoftware\PowerShellServer /v SFTPRootDir HKEY_LOCAL_MACHINE\SOFTWARE\nsoftware\PowerShellServer SFTPRootDir REG_SZ C:\Users\Public\Documents
When you change the registry value, the next SFTP connection you make to the system will use the new location; you don't have to restart the SFTP service.
Created: Wednesday January 7, 2015