Delete a specific file

I need to delete a specific .docx that a user posted with sensitive information as soon as possible. Please help! :sweat_smile:

2 Likes

Sorry for not including more details in my OP, I was a bit panicked. Here’s a bit more background.

The file was originally published in a post I have since deleted. The link to the file in that post was something like like this: https://example.com/uploads/short-url/3_FILE_ID.docx

I assumed that the file would be somewhere in /shared/standalone/uploads/default, but I haven’t been able to find it through this:

find . | grep "3_FILE_ID.docx"

So that’s where I’m stuck currently.

If it happened to me I’d start looking in the uploads folder.
Example

csmubd2lcomau:~ admin$ /scripts/connect-to-server/sydney-10.8.0.1.sh 
ssh -R 52698:localhost:52698 ceiteach@ceiteach@10.8.0.1
Last login: Tue Jun 18 16:15:05 2019 from 10.8.0.2
[ceiteach@sydney ~]$ sudo bash
[root@sydney ceiteach]# cd /var/discourse/shared/standalone/uploads/default/o
optimized/ original/  
[root@sydney ceiteach]# cd /var/discourse/shared/standalone/uploads/default/original/1X/
[root@sydney 1X]# ls *.docx
2d7aced744661d422e1b66e02a12f1617acf13ed.docx  e759a55a7284e4bc80f6be55a3013d4c49e8277b.docx
[root@sydney 1X]# pwd
/var/discourse/shared/standalone/uploads/default/original/1X

Maybe revoke read privileges … check the consequences of removing the file … and delete the post that the user made.

1 Like

ls *.docx and check the contents of the files you find.
the file name might be a hash of the contents.

2 Likes

Thanks @csmu for the help, I found the file!

I’ll document what I ended up doing in case this is helpful for future travellers:

  1. I navigated to the /var/discourse/shared/standalone/uploads/

  2. I searched for the relevant filetype like this: ls -Rl | grep ".docx"

    (I was originally searching for files published in 2019 without noticing that for files created in the current year the l flag replaces the year with the creation time.)

  3. I looked at the list of files and found the one (there was only one in my case) that was posted today.

  4. I downloaded the file to make sure, by using a command like this on my local machine:

    scp servername:/var/discourse/shared/standalone/uploads/default/original/2X/1/FILE_ID.docx ~/Downloads
    
  5. After I confirmed that it was the file I wanted, I just deleted it (rm /var/discourse/shared/standalone/uploads/default/original/2X/1/FILE_ID.docx)

Rejoice!

5 Likes

Glad you found it! If you need to do it again, If you still have the post that links the file, you can right click to get the path /filename rather than spelunking to find it.

1 Like

The filename linked to in the post was different from the filename in the system. That’s what threw me off originally.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.