LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Who/What is using my Symbolic Link (https://www.linuxquestions.org/questions/linux-security-4/who-what-is-using-my-symbolic-link-4175554073/)

Cpare 09-21-2015 07:56 AM

Who/What is using my Symbolic Link
 
on Friday we moved user home folders between NAS volumes, immediately afterwards we started seeing our application hanging and not responding. To restore service we created a symbolic link directing home folder calls to the new location.

Now that we have service restored we need to clean things up and make the transition complete, how do we find who/what is using the symbolic link? My goal is to identify the users/usage, correct the problem, and then monitor to ensure we don't see additional references before we remove the link. Measure/Adjust/Measure - Imaging that :)

For those that will ask "Why remove the link"?
(a) Keeping the system clean and easy to sustain is the right thing to do.
(b) The link lives on the old NAS volume that needs to be decommissioned.

Habitual 09-21-2015 08:12 AM

I use lsof sometimes like so
Code:

lsof +D /directory/to/monitor

Cpare 09-21-2015 10:19 AM

Quote:

Originally Posted by Habitual (Post 5423414)
I use lsof sometimes like so
Code:

lsof +D /directory/to/monitor

Thanks for the suggestion, it gave me a good start!

Habitual 09-21-2015 10:20 AM

You are welcome!

sundialsvcs 09-22-2015 09:11 AM

I would simply grep in the source-code directories. (Or even object-code.)

Cpare 09-22-2015 11:12 AM

Hello - as a follow-up to this it looks like the lsof is resulting the files locked weather the user is following the symbolic link or not.

Cpare 09-22-2015 11:31 AM

Quote:

Originally Posted by sundialsvcs (Post 5423948)
I would simply grep in the source-code directories. (Or even object-code.)

Good suggestion, however this is a vendors application with compiled code and configuration files stored in multiple locations including a database. As we hunt for all the places we need to update I need a way to monitor the users we are testing with to see if we have found all the settings before removing the symbolic link for all our users.

suicidaleggroll 09-23-2015 08:00 PM

Quote:

Originally Posted by Cpare (Post 5424006)
Hello - as a follow-up to this it looks like the lsof is resulting the files locked weather the user is following the symbolic link or not.

What if instead of using the symlink you use "mount --bind" to remount the new home directory in the old location? lsof might behave as you hope in that case, not sure since ultimately they are still using the same files.


All times are GMT -5. The time now is 01:26 AM.