Gostaria de abordar a parte:
https://stackoverflow.com/a/17483998/156458, https://unix.stackexchange.com/a/238413/674 and https://unix.stackexchange.com/a/169035/674 all recommended using
sudo sh -c "ulimit -c 1024 && exec su $LOGNAME"
. But bothulimit -c 1024
andexec su $LOGNAME"
only affects the shell created by sudo, so what is the purpose of the command?exec su $LOGNAME"
also doesn't do anything meaningful to make use of the changed limit. I am very confused and wonder if I am missing something.
Eu fiz alguns experimentos e descobri que depois de executar
sudo sh -c "ulimit -c 1024 && exec su $LOGNAME"
-
ulimit -c 1024
de fato modifica os valores limite, mas somente dentro do shell emsudo
sob o shell original; -
exec su $LOGNAME"
me dará um shell emsu
sobsudo
sob o shell original esu $LOGNAME"
redefinirá os limites para os valores padrão do usuário$LOGNAME
.
Portanto, o comando sugerido pelos links não funciona.
para o tamanho do arquivo principal:
$ ulimit -c -H; ulimit -c;
unlimited
0
$ ulimit -c 1024
$ ulimit -c -H; ulimit -c;
1024
1024
$ ulimit -c 10000
bash: ulimit: core file size: cannot modify limit: Operation not permitted
$ sudo sh -c "ulimit -c 10000 && ulimit -c -H && ulimit -c && exec su $LOGNAME"
[sudo] password for t:
10000
10000
$ ulimit -c -H; ulimit -c;
unlimited
0
$ ~/bin/get-ancestry-processes.sh
systemd,1 splash
└─lxterminal,1242,t
└─bash,22778
└─sudo,22800,root sh -c ulimit -c 10000 && ulimit -c -H && ulimit -c && exec su t
└─su,22802 t
└─bash,22803,t
└─get-ancestry-pr,22819 /home/t/bin/get-ancestry-processes.sh
└─pstree,22820 -G -a -s -l -p -u 22819
para o número de arquivos abertos, para refazer a experiência no link , mas com um valor-limite diferente para definir para
$ ulimit -n -H; ulimit -n;
1048576
1024
$ ulimit -n 512
$ ulimit -n -H; ulimit -n;
512
512
$ ulimit -n 10000
bash: ulimit: open files: cannot modify limit: Operation not permitted
$ sudo sh -c "ulimit -n 10000 && ulimit -n -H && ulimit -n && exec su $LOGNAME"
10000
10000
$ ulimit -n -H; ulimit -n
1048576
1024