Delete Unseen Objects

Somehow, I have objects that were uploaded using a different passphrase (not sure which or how) but is there a way to delete those? Aka delete the objects that the website says “ of items are here under a different passphrase” without deleting the full bucket and remaking it?

You can delete objects with an unknown passphrase using the uplink cli. rm - Storj Docs

I tried listing them with “ls” command but they don’t seem to show up… is there a way to identify which are the ones that are missing?

It’s a bit of a hack but maybe you could find the missing ones by matching up the created date between the encrypted list and the unencrypted list. This probably doesn’t work if multiple objects were created in the same second though.

$ uplink ls --recursive --output json sj://passphrase-test/ | sort --field-separator=, --key=2 | tee keys
{"kind":"OBJ","created":"2023-09-28 10:27:21","size":0,"key":"cheese"}
{"kind":"OBJ","created":"2023-09-28 13:28:15","size":0,"key":"ham/eggs"}

$ uplink ls --encrypted --recursive --output json sj://passphrase-test/ | sort --field-separator=, --key=2 | tee encrypted_keys
{"kind":"OBJ","created":"2023-09-28 10:27:21","size":0,"key":"AkcwqsEXzQ_K4udwdTW_VRtDzqz-Ar8qg-fUSmeisbibfMmH"}
{"kind":"OBJ","created":"2023-09-28 13:12:51","size":0,"key":"AogklE7SMvkCIbK9xdZjYTH7hlLVrYSUqvi7R1z6HKNS8A==/AoZrKmuDNPHVps9pP9sMtYUZZTyIrVwxkHnZGAhhp7U="}
{"kind":"OBJ","created":"2023-09-28 13:12:56","size":0,"key":"AogklE7SMvkCIbK9xdZjYTH7hlLVrYSUqvi7R1z6HKNS8A==/AoZrKmuDNPHVps9pP9sMtYUZZTyIrVwxkHnZGAhhp7U=/AlJ3v-vrreytXzhJS4XDaZ_QZj4efbc630tKNS4BAsZ3zaTC"}
{"kind":"OBJ","created":"2023-09-28 13:12:59","size":0,"key":"AogklE7SMvkCIbK9xdZjYTH7hlLVrYSUqvi7R1z6HKNS8A==/AoZrKmuDNPHVps9pP9sMtYUZZTyIrVwxkHnZGAhhp7U=/Arybd-W46wftaZmXGr5AqE3b6eCIc9gD8yMZJhFbaTOxjA=="}
{"kind":"OBJ","created":"2023-09-28 13:28:15","size":0,"key":"ApT4sHqcvUR04grCRmN4HPZhEOnH6phF36kBAe_Sam4J/AnVKToBl0qgzYupE76BH7iCZC8JtfRb-ATgUwSDMucW0oQ=="}
{"kind":"OBJ","created":"2023-09-28 14:13:44","size":0,"key":"AogklE7SMvkCIbK9xdZjYTH7hlLVrYSUqvi7R1z6HKNS8A=="}

$ join --check-order -j 2 -t, -o 1.4 2.4 -a 2 -e '"key":"UNKNOWN"' keys encrypted_keys
1 Like

You can delete objects where you lost an encryption phrase:

  1. Create an access grant using your current encryption phrase
  2. Setup an uplink with that access grant

To list buckets:

uplink ls

Make sure that you can see decryptable objects in your buckets:

uplink ls sj://my-bucket

if you see your objects, then the current encryption phrase is correct. To remove objects, where you do not remember the encryption phrase you may use --encrypted flag, but it will also remove decryptable objects in this bucket.
So, you need to move decryptable objects out of this bucket to some other bucket, then remove not decryptable.

To make a temporary bucket:

uplink mb sj://temp-bucket

To move decryptable objects:

uplink mv --recursive --parallelism 100 sj://my-bucket sj://temp-bucket

Check that there is no more decryptable objects:

uplink ls sj://my-bucket

now you can remove that bucket, include all not decryptable objects:

uplink rb --force sj://my-bucket

After that you may create this bucket back

uplink mb sj://my-bucket

Or you may remove only not decryptable content instead of the bucket:

uplink rm --recursive --encrypted --parallelism 100 sj://my-bucket

After that you can move decryptable objects back to the cleaned bucket:

uplink mv --recursive --parallelism 100 sj://temp-bucket sj://my-bucket

then remove the temp bucket

uplink rb sj://temp-bucket
1 Like

Thank you, this was able to resolve my issue.

1 Like