Reputation: 361
Is there any way to a map a symbolic link directory to different directories based on the user id in Linux. For instance if a user X executes cd /var/www/html/
then his/her directory gets changed to /var/www/webX/
, while for the user Y it would be /var/www/webY
. The purpose of doing this is to make the web document directories transparent for different apache users.
Thanks
Upvotes: 0
Views: 167
Reputation: 599
One line answer: No. The linux filesystem does not support conditional symlink evaluation of the type you are envisioning.
Alternatives:
=> (Programmatically) Create symlinks in each user's home directory which point to the required location in /var/www/
. For example, in user X's home directory:
ln -s /var/www/htmlX htmldir
In user Y's home directory:
ln -s /var/www/htmlY htmldir
So that each user can just go cd htmldir
and get to the appropriate location.
=> Use the per-user directory feature to assign ~user/public_html
or more generically, ~user/<some-name-consistent-across-users>
as the HTML dir for user
.
Upvotes: 1