In a python script, I am creating a bunch of symbolic links chained together.
example: link1->link2->link3->.......->somefile.txt
I was wondering how you can change the max number of symlinks to be greater than 20?
In a python script, I am creating a bunch of symbolic links chained together.
example: link1->link2->link3->.......->somefile.txt
I was wondering how you can change the max number of symlinks to be greater than 20?
On Linux (3.5 at least), it's hardcoded to 40 (see follow_link()
in fs/namei.c
), and note that it's the number of links followed when resolving all the components of a path, you can only change it by recompiling the kernel.
$ ln -s . 0
$ n=0; repeat 50 ln -s $((n++)) $n
$ ls -LdF 39
39/
$ ls -LdF 40
ls: cannot access 40: Too many levels of symbolic links
$ ls -LdF 20/18 10/10/10/6
10/10/10/6/ 20/18/
$ ls -LdF 20/19 10/10/10/7
ls: cannot access 20/19: Too many levels of symbolic links
ls: cannot access 10/10/10/7: Too many levels of symbolic links
/usr/include/x86_64-linux-gnu/sys/param.h
on my system), and is not intended to be modified by users. – ire_and_curses Oct 28 '12 at 05:57