FTP "Aliases" on a Server by Mounting

If you are having a hard time trying to get your FTP program to find and use an alias to a directory on a server, you are trying to use the alias in the wrong way. What you are looking to do is mount a directory and bind it to another directory.  

The Problem

Say you have shell (SSH) access to a server. Logging in (scp username@server_address) you are taken to your personal user folder on that server (say "/home/johnvsc").   Now, you can traverse the directories with "cd" and you can also add an alias to your .bashrc or .profile  However, the problem is that those files are loaded into memory when you log in under SSH -> not when you log into FTP; therefore, those aliases are invisible to FTP.  

The Solution

Before you start, you probably want to make sure you have SUDO permissions (or do this logged in as "root"). If you don't, find an admin that can do this for you. If you don't know because it is your own box/slice; you get to figure it out ;)   To access a different directory from your user folder:

  1. Create a directory in your user directory that describes what the directory does:

    mkdir /home/johnvsc/link_to_www

  2. Mount an alias to that new directory:

    sudo mount --bind /srv/www/public_html /home/johnvsc/link_to_www

  3. Then when johnvsc logs in he can click the link_to_www directory and be taken to /srv/www/public_html


See, it is easy when you know how to do it.

I hope this saves you hours of frustration, like it has saved me!

Share This