RDP File Transfer
RDP (Remote Desktop Protocol) is commonly used in Windows networks for remote access. We can transfer files using RDP through multiple methods.
Method 1: Copy and Paste
The simplest method is copying and pasting files:
- Right-click and copy a file from the Windows machine you connect to
- Paste it into the RDP session
Note: If connecting from Linux using xfreerdp or rdesktop, copy from the target machine to the RDP session may work, but there may be scenarios where this may not work as expected.
Method 2: Mount Local Folder (Linux to Windows)
As an alternative to copy and paste, we can mount a local resource on the target RDP server.
Using rdesktop
Mount a Linux folder using rdesktop:
rdesktop 10.10.10.132 -d HTB -u administrator -p 'Password0@' -r disk:linux='/home/user/rdesktop/files'
Using xfreerdp
Mount a Linux folder using xfreerdp:
xfreerdp /v:10.10.10.132 /d:HTB /u:administrator /p:'Password0@' /drive:linux,/home/plaintext/htb/academy/filetransfer
Accessing the Mounted Drive
To access the directory in the RDP session, connect to \\tsclient\:
- Navigate to
\\tsclient\linux\(or the name you specified) - This allows you to transfer files to and from the RDP session
Method 3: Mount Local Drive (Windows to Windows)
From Windows, use the native mstsc.exe remote desktop client:
- Open Remote Desktop Connection (
mstsc.exe) - Click “Show Options”
- Go to the “Local Resources” tab
- Click “More…” under “Local devices and resources”
- Expand “Drives” and select the drive(s) you want to share
- Click “OK” and connect
After selecting the drive, you can interact with it in the remote session that follows.
Note: This drive is not accessible to any other users logged on to the target computer, even if they manage to hijack the RDP session.
Common Options
rdesktop
-d <domain>: Domain name-u <user>: Username-p <password>: Password-r disk:<name>=<path>: Mount local directory as network drive
xfreerdp
/v:<host>: Server hostname or IP/d:<domain>: Domain name/u:<user>: Username/p:<password>: Password/drive:<name>,<path>: Mount local directory as network drive