Symlink from one workstation to another without mount
You can't:
A symlink is simply an extra inode (a structure that points to the file) and this inode consists of, amongst other things, a deviceId
and an inode pointer
. The deviceId
effectively points to a device special file within the /dev
directory and the inode pointer
points to a block on that device.
Your network location of 10.0.1.103
does not and cannot have an deviceId
(it's not in /dev
) therefore you can't possibly have a symlink to a network location.
On the other hand, a mounted network share will have a deviceId
which is why you can create a symlink to a mounted location.
Windows has a special syntax \\MACHINE\DIRECTORY…\FILE
meaning the file located at \DIRECTORY…\FILE
on the machine called \\MACHINE
over the SMB protocol. This is built into the operating system and specialized to one network protocol.
Linux has a flexible filesystem based on the notion of mounting. Filesystems are attached to an existing directory, and the administrator gets to choose how to arrange the directory hierarchy. For more background, read What is meant by mounting a device in Linux?, Why is Linux's filesystem designed as a single directory tree? and What mount points exist on a typical Linux system?. Linux supports many network filesystems (i.e. filesystems that allow one machine to access files on another machine), including NFS, SMB, SSHFS, etc.
NFS can be considered Linux's native network filesystem, the way SMB is Windows's. However Linux doesn't export its files by default: you need to install an NFS server. An NFS server is available in all Linux distributions, but requires a bit of setup (you need to register the directories you want to export in the file /etc/exports
). Furthermore NFS is from a gentler time when attackers on the local network weren't a concern, and securing it requires a bit of knowledge about firewalls which is beyond the scope of this answer. To make the directory /some/where
from the remote machine foo.example.com
available at the location /local/dir
(which must be an existing directory), assuming that it is exported by the remote machine, run the following command as root:
mount foo.example.com:/some/where /local/dir
The easy way to access remote files with next to no setup is over SSHFS. All you need is to install an SSH server on the remote machine, and the sshfs
package on the local machine. You should also generate a key (see How to make password-less login work), though you don't have to do it if you don't mind entering your password each time. SSH is additionally useful to run commands on the remote machine. To make the directory /some/where
from the remote machine foo.example.com
available at the location /local/dir
(which must be an existing directory) over SSHFS, run the following command (as your usual user):
sshfs foo.example.com:/some/where /local/dir
Linux can be a server or a client for the SMB protocol (communicating with Windows machines, or even with other Linux machines though it's less well integrated than other protocols) through the Samba software.
You can set up an automounter (such as autofs
) so that accessing certain directories automatically mounts directories from some remote machine. For example, a common configuration arranges that the autofs filesystem is mounted on the directory /net
, and accessing /net/MACHINE/DIRECTORY
causes the remote directory /DIRECTORY
from /net/MACHINE
to be mounted over NFS at that location (and it will be unmounted after a certain period of inactivity). The remote machine must of course have an NFS server set up and allowing that connection.
It is possible to set up an automounter with SSHFS. See Totally Seamless SSHFS under Linux using Fuse and Autofs and Autofs and sshfs – the perfect couple for quick tutorials; in a nutshell:
- Install
autofs
andsshfs
. Add the following line to
/etc/auto.master
:/mnt/sshfs /etc/auto.sshfs uid=1000,gid=1000,--timeout=30,--ghost
Replace the two occurrences of 1000 by your user id and group id (run
id -u
andid -g
to show these values). Create the directory/mnt/sshfs
.Create a file
/etc/auto.sshfs
containing lines like the following:machinename -fstype=fuse,rw,nodev,nonempty,noatime,allow_other,max_read=65536 :sshfs\#machinename.example.com\:
where
machinename.example.com
is the host name (or IP address) of the remote machine andmachinename
is the name you want to access it as locally, via the path/mnt/sshfs/machinename
.
Autosshfs provides a more convenient autofs+sshfs setup.
Finally, regarding the symbolic part: you can create a symbolic link to a non-existent path. The symbolic link is the second argument, so you'll need something like
ln -s /net/10.0.1.103/sharedFolder/symlinkFile.mov /link/to/local/file.mov
You'll need to manually or automatically arrange for /sharedFolder
from 10.0.1.103
to be mounted at /net/10.0.1.103/sharedFolder
.