Sorry for the vague title.
I have a folder /opt/A/B/ and ideally, I want to symlink ~/B to /opt/A/ such that ~/B and /opt/A/B are in sync.
The obvious answer would be:
sudo rm -r /opt/A/B
sudo ln -s ~/B /opt/A/B
However, consider this scenario:
A is owned by root, but B is owned by me, and I don't want to use sudo (this operation is a python script that gets run by a very big thing that doesn't have sudo).
This is another approach (remember, I have ownership of /opt/A/B/):
ln -s ~/B/* /opt/A/B/
But then it will go out of sync if new directories/files get written in /opt/A/B or ~/B.
So my question is the following:
Is there any sudo-less way to do this?
I can use sudo for any one-time only operations that will not go in the script. If it matters, the goal is to rotate the symlink depending on certain configurations, so I do have a finite amount (specifically 3). Note: Can also be