Sorry if I wasn't clear on what I was suggesting.
For the user to run admin/tool/task/cli/schedule_task.php as, you will need to determine this. Checking which user owns the files in moodledata/filedir may help (for example: with ls -lh), or indeed the owner of moodledata/lock/5c/5c06584b18d6ad7a3d656bd935efc66b. Trying each user I gave as examples is unlikely to identify this user, and your server may have specific users for each web site.
You would then need to suspend the running of the site cron (admin/cli/cron.php). For example: make a note of the current entry, then remove it. If you don't suspend this then the cron will attempt to run processenrolments_task when the lock is deleted creating the lock file again and preventing the task being manually run.
Then enable debugging (Debug messages: DEVELOPER, Display debug messages: Yes).
Then delete the lock file, moodledata/lock/5c/5c06584b18d6ad7a3d656bd935efc66b.
Then run the task, sudo -u USERNAME php admin/tool/task/cli/schedule_task.php --execute='\enrol_attributes\task\processenrolments_task' where USERNAME is the server user account you have determined PHP scripts are being run as.
Hopefully there'll be some output, maybe an error message or other output providing some clue as to what is going wrong with the task. The problem with the lock file suggests the task doesn't end normally but it may just hang,
Then turn debugging off again, you don't normally want this on a production site.
Then unsuspend the site cron, for example: add this again if it was removed.