Changing the Default Directory when Connecting to OpenSSH Server on Windows Server 2022
When connecting to an OpenSSH server on Windows Server 2022 using FileZilla, the default directory that opens is usually the user's home directory. However, you may want to change this default directory to a different location for various reasons. This article will guide you through the process of changing the default directory when connecting to an OpenSSH server on Windows Server 2022.
Prerequisites
Before you begin, ensure that you have installed the OpenSSH Server feature on your Windows Server 2022. You can do this by following these steps:
- Open the Server Manager.
- Click on "Add roles and features."
- Select "Role-based or feature-based installation" and click "Next."
- Select your server from the server pool and click "Next."
- Expand "Remote Server Administration Tools" and select "Feature Administration Tools."
- Check the box for "OpenSSH Server" and click "Install."
Changing the Default Directory
To change the default directory that opens when connecting to the OpenSSH server on Windows Server 2022, you need to modify the sshd\_config file. Here are the steps to follow:
- Open the Windows PowerShell as an administrator.
- Type the following command to open the sshd\_config file in Notepad:
notepad C:\ProgramData\ssh\sshd\_config- Add the following line to the file:
Match User MyUserChdir /C/Users/MyUser/DesiredDirectory- Replace "MyUser" with the username that you use to connect to the server, and replace "DesiredDirectory" with the path to the directory that you want to open by default.
- Save the file and close Notepad.
- Restart the OpenSSH Server service by running the following command:
Restart-Service sshdConnecting to the Server
After changing the default directory, you can connect to the OpenSSH server on Windows Server 2022 using FileZilla or any other SFTP client. The default directory that opens should now be the one that you specified in the sshd\_config file.
Changing the default directory when connecting to an OpenSSH server on Windows Server 2022 is a simple process that involves modifying the sshd\_config file. By following the steps outlined in this article, you can easily change the default directory to any location that you prefer.
References
Type: Article
Title: How to Install the OpenSSH Server Feature on Windows Server 2019
Author: Microsoft Docs
Link: https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh\_install\_firstuse
Type: Article
Title: How to Change the Default Directory for SSH on Ubuntu 20.04
Author: DigitalOcean