What file mode is a symlink?
File modes cover two different notions: file types and file permissions. A file's mode is represented by the value of st_mode
in the result of stat(2)
calls, and ls -l
presents them all together; see Understanding UNIX permissions and file types for details.
Once a file is created its type can't be changed. In addition, on Linux systems you can't specify a symlink's permissions; all that matters is the target's permission (and effectively the full mode since that determines the symlink's behaviour too). See How do file permissions apply to symlinks? for details. On Mac OS X symlinks can have their own permissions.
Finally, git
uses a simplified model, with a limited number of recognised modes:
040000
for a directory100644
for a normal file100755
for an executable file120000
for a symbolic link
You can see these values using commands such as git cat-file -p 'master^{tree}'
; see Pro Git for details.