Dangerous behavior while removing a symbolic link
I've recently created a symlink from my application to the main server storage on my client's host. Yesterday, when I wanted to remove my application, I did the usual routine: I first deleted the symlink via the file manager, expecting only the link itself to be removed. However, I surprisingly saw that the entire server storage (130GB of data) had disappeared, and yet the symlink itself was still there! Fortunately, I was left the "skip the trash" option unchecked, so I was able to restore the files from there.
What's the reason behind this behavior in cPanel?
FYI, the `rm` command under no circumstances (even with extra flags) allows following symlinks, and the same goes for TinyFileManager, which is safe in this aspect. Also I don't think it's user friendly.. It's somehow similar to shortcuts in Windows and no users expect to delete a shortcut's target while deleting itself!
Some related links:
If path names a symbolic link, unlink() shall remove the symbolic link named by path and shall not affect any file or directory named by the contents of the symbolic link - man7.org/linux/man-pages/man3/unlink.3p.html
In no case will rm(1) affect the file referred to by slink. - https://man7.org/linux/man-pages/man7/symlink.7.html
-
Hey there! This is a known issue that we're working on as part of case CPANEL-56463. I've linked this thread to the case so I'll be sure to post an update as that gets handled on our end.
0 -
Update - a fix for this is scheduled to go out later today!
0 -
This was update was released as part of the targested security release on Tuesday.
0
Please sign in to leave a comment.
Comments
3 comments