A symlink (though some filesystems handle symlinks differently) is an inode
table entry that points to the same place as another file (or directory).
For example if foo
is inode 1234
then bar
(a symlink to foo) is inode 1234
.
bar
doesn't really exist it's just a pointer to a "real" file.
Symlinks
generally don't have permissions outside the permissions of the file they point to. So bar's
permissions are "the same" as foo's
. You can't set permissions on bar
(the symlink) only on foo
(the real file).
That being said, it's a really high level view. Different file systems handle symlinks differently. Different tools handle symlinks
differently. Some file systems "flag" symlinks
and handle them specially, but some don't.
For example chmod
on Linux
won't change a symlinks
permissions but on OSX
you can get it to. In both cases the real files permissions are changed.
I can not think of any system (doesn't mean it's not out there) where a symlink
has permissions separate from the real file.
chmod
sets permission bits (rwx and sticky/setuid/setgid bits, ...) : this is what we call a "mode". But you seem to be referring to file types instead. – John WH Smith Mar 30 '15 at 21:31