docs/pages/enroll-resources/desktop-access/directory-sharing.mdx
Directory Sharing is a Teleport feature of that makes it easy to move files between a local machine and a remote desktop—and apply changes to those files—without compromising security.
During a remote desktop session, you can select a folder on your local workstation to share with the remote desktop. Changes to the folder on either the remote desktop or your workstation are reflected on both machines for the duration of the session.
The shared directory makes it convenient to download log files, edit configuration files, or perform any other file manipulations on a remote Windows desktop. You can disable Directory Sharing for specific users via their Teleport roles, and use session recording to audit activity in the shared directory after the session ends.
(!docs/pages/includes/edition-prereqs-tabs.mdx!)
The Teleport Desktop Service with at least one remote desktop registered in your cluster. If you have not yet configured desktop access, read Getting Started with desktop access before beginning this guide.
Teleport Connect app or a browser on your local machine. The browser must support the File System Access API, which Teleport uses for Directory Sharing. We support the latest versions of Chromium-based browsers like Google Chrome, Brave, and Microsoft Edge.
Brave users can enable the File System Access API by navigating to brave://flags/#file-system-access-api and selecting "Enable".
You can see a full compatibility table in the Mozilla Developer Network documentation.
(!docs/pages/includes/tctl.mdx!)
To share a directory, open the Teleport Web UI or Teleport Connect, find the desktop, and click 'Connect' to start a session.
Once the session starts, click the three-dot menu on the top-right of the screen and click "Share Directory":
For security reasons, the web browser's filesystem access API prohibits you from sharing certain directories, including the standard locations for commonly used user directories such as "Desktop" and "Documents", as well as critical directories more typically used by the operating system itself.
For a full list of the blocked user directories, see the File System Access Specification.
Subdirectories within these blocked user directories may still be shared.
<Admonition type="note">This restriction only affects the Web UI. Teleport Connect uses a native file system API, so it can share any directory on your local machine.
</Admonition>Based on testing, we have determined that directory sharing leads to unexpected errors if you share directories whose names (including all path segments) have 640 characters or more.
If you are using a browser to share a directory, you'll be prompted to grant permission for it to make changes. You will need to accept this prompt to enable directory sharing.
After you grant permissions, you will see a new directory in File Explorer on the remote desktop. The directory will have the same name as the directory on your local machine, but with "on teleport" appended to the name.
You can only share a single directory at a time.
You can easily share files—and file modifications—between your local machine and the remote desktop.
When you create, edit, or delete a file in the shared directory on the remote side, these changes will be applied to the directory on your local machine.
If you move a file into the shared directory on the remote side, that file will appear on the local side as well. And if you move a file outside the directory on the remote side, the remote desktop will copy it, keeping it within the shared directory.
You can also copy a file from one subdirectory within the shared directory and paste it into another—the local side will reflect the changes.
<Admonition type="warning">Directory Sharing does not support moving files between subdirectories within the shared directory on the remote side.
</Admonition>You can create, edit, and delete files in the shared directory on your local machine, as well as move files between subdirectories.
To view your local changes on the remote side, you will need to either refresh or re-open the remote directory, or re-open any individual files you changed locally. When you do this, the remote desktop will request the current state of the directory from your local machine.
Performance for moving large files to and from the shared directory will depend on network conditions, and file editing performance will depend on the program you use to edit files.
While there is no size limit for files within your shared directory, we only recommend manipulating files up to 32 MB to reduce the impact of the shared directory on network bandwidth and system resources.
To stop sharing a directory, end your remote desktop session. Navigate to the three-dot menu on the upper-right of the desktop session and click "Disconnect."
The next time you start a session on the remote desktop, the directory will no longer be shared. You will need to share the directory again to access its content.
The Teleport Auth Service grants access to Directory Sharing on a remote desktop based on the roles of the user who initiates the desktop session.
A Teleport role enables Directory Sharing by default. If one of a user's Teleport roles disables Directory Sharing, then Directory Sharing will be disabled for that user.
To disable Directory Sharing for a Teleport user, define a role similar to the
following in a file called role.yaml:
kind: role
version: v5
metadata:
name: "no-sharing"
spec:
options:
desktop_directory_sharing: false
Create the role:
$ tctl create -f role.yaml
(!docs/pages/includes/create-role-using-web.mdx!)
(!docs/pages/includes/add-role-to-user.mdx role="no-sharing"!)
Directory Sharing is a powerful tool for editing files on remote desktops, and you'll want to make sure you have a comprehensive audit trail so you can conduct a post-incident retrospective or investigate unintended usage. Learn how to set up session recording for desktop access.
Aside from Directory Sharing, the Teleport Desktop Service also enables you to share the contents of your clipboard with a remote desktop. Learn how to use Clipboard Sharing.
Directory Sharing involves a browser on a local workstation and a remote Windows desktop.
On the remote side, Directory Sharing takes advantage of file system-related messaging within the Remote Desktop Protocol (RDP). On the local side, the Teleport Web UI uses the browser's File System Access API to read from and write to a user-selected local directory.
The Teleport Web UI establishes a secure WebSocket session with the Teleport Proxy Service, which forwards traffic to and from the relevant Teleport Desktop Service instance.
The Teleport Desktop Service enables the Web UI to communicate with remote desktops by implementing Teleport Desktop Protocol (TDP), which creates an abstraction layer between the WebSocket protocol and RDP.
The Teleport Desktop Service converts TDP traffic from the Teleport Web UI into RDP traffic to send to the remote desktop. The Desktop Service also converts RDP traffic from the remote desktop into TDP messages to send to the Teleport Web UI. Based on these messages, the Teleport Web UI advertises information about—or performs modifications on—the shared directory.
You can read more about TDP in Teleport RFD 37 and how Directory Sharing uses it in RFD 67.
Directory Sharing involves a Teleport Connect app on a local workstation and a remote Windows desktop.
On the remote side, Directory Sharing takes advantage of file system-related messaging within the Remote Desktop Protocol (RDP). On the local side, Teleport Connect uses Go's native file system API to read from and write to the user-selected directory
Teleport Connect establishes a secure mTLS connection to the Teleport Proxy Service, which forwards traffic to and from the relevant Teleport Desktop Service instance.
Just like the Web UI, Teleport Connect uses the Teleport Desktop Protocol (TDP) to communicate with the Teleport Desktop Service, which then connects to the remote desktop via RDP.