Hi, Nick, thanks for your reply!
I have also considered the solution of cleaning folders regularly, but it is 
not easy to set up a cleaning process for each folder. If I directly clean the 
entire upper-level folder, it will affect the active connections.
In fact, I also plan to modify the logic of guacamole-client, set a folder for 
each connection, and then let guacd delete the file after disconnection, that 
is, add this part of the code in the guac_rdp_fs_delete function, such as 
rmdir(fs->drive_path). This seems to be a relatively simple way to achieve my 
goal, and it will not affect other links.
I wonder if there are other things to consider? I just glanced at the guacd 
code in this section and I don't know if these functions will affect other 
places.



| |
Alex_Yin
|
|
skyywh2...@163.com
|


---- Replied Message ----
| From | Nick Couchman<vn...@apache.org> |
| Date | 04/23/2025 03:45 |
| To | <user@guacamole.apache.org> |
| Subject | Re: How to delete the local folder created by create-drive-path in 
guacd when the RDP connection is disconnected. |
On Mon, Apr 21, 2025 at 10:37 PM Alex_Yin <skyywh2...@163.com> wrote:



Hello! I am trying to connect to Windows using rdp through guacamole, and 
successfully mounted the network drive. But when I used the network drive to 
download something and disconnected the link, the folder created by guacd 
locally was still there. After reading the source code, I found that guacd does 
not delete the created folder after disconnecting the link, and there is no 
parameter to achieve this function. I started guacd through docker, and the 
version used is guacamole 1.5.0.

You are correct - there is no such parameter to accomplish this, and the code 
does not do it by default. The assumption made in implementing it is that users 
and admins would want the storage location to be persistent across multiple 
systems and multiple logins. Personally, I use this to provide persistent 
storage across the systems that I access from Guacamole - having it removed 
each time would be disastrous :-D.


That doesn't make your request or situation invalid - you just have a different 
use-case.
 

The parameters are as follows: "enable-drive": “true","create-drive-path": 
“true","drive-name": “disk","client-name": “nickname","drive-path": 
"/Users/alex/guacd/disk/"

I desire a solution where the folders generated by guacd are deleted upon 
disconnection. Is there a method to achieve this function?



I can think of one way to (sort of) accomplish this without modifications to 
the code - if you use the extension that allows for viewing connection 
recording history in the web interface 
(https://guacamole.apache.org/doc/gug/recording-playback.html), you could use 
the ${HISTORY_UUID} token within the drive-path parameter, and, you'd 
essentially get a unique folder for each connection. You could then have a 
process run once per day to clean up any folder older than 1 day, or whatever 
parameters work for you.


That's a sort of round-about way to accomplish it - the more proper way would 
be some sort of connection parameter ( "delete-drive": "true") that would 
delete it upon disconnect. However, you'd want to carefully consider all the 
possible scenarios with this - for example, let's say you have two RDP 
connections, RDP1 and RDP2, both pointed at the same folder 
("/Users/alex/guacd/disk"). What happens when you disconnect from RDP1 but RDP2 
is still running?? There may be some way that guacd could check for open 
handles on that file and delete only if nothing has it open, but that's adding 
a decent amount of complexity to that code.


-Nick

Reply via email to