the header image

Bulk Change “Get Link” Permission in Google Drive

I'm glad you were able to find this blog article! Hopefully you didn't spend hours of searching the internet like I did in order to figure this out. It seems like everything out there is a paid Google Workspace Addon, well this is completely free!

Yes, this actually works and is fairly easy.


You need to remove the "Get Link" permission on files in Google Drive for many files or many users, or many users with many files.


Stand up a Debian 10 x64 server and installed GAMADV-XTD3

This allows you to connect to the Google Drive API and modify the Permission ACL that allowed ALL USERS in the company to see everyone's files.

Run the follow commands once you've created the API oAuth connection in Google using GAM.
Gather a list of ALL files shared with a link for a specific user, note all variable are in "{ }" and will need to be replaced.:
gam user {enterUserEmail} show filelist query 'visibility = "anyoneCanFind" or visibility = "anyoneWithLink" or visibility = "domainCanFind" or visibility = "domainWithLink"' > /usr/share/{enterUserEmail} _linkenabled.csv
Once that is complete, Run the following to pull a sample ID of a file listed above so I could find the ID of the ACL to remove:
gam user {enterUserEmail} show drivefileacl {enterID}
Once you have the ACL ID, run this command:
gam csv /usr/share/{enterUserEmail}_linkenabled.csv gam user ~Owner delete drivefileacl ~id id:{enterACL-ID}

That will remove the ACL that shares the LINK with everyone in the company. This can take hours, but it's all automated.

Leave a reply

Your email address will not be published.