To solve the problem in https://unix.stackexchange.com/a/446428/674, I followed https://stackoverflow.com/a/17483998/156458, but it doesn't set core file limit size?
$ sudo sh -c "ulimit -c 1024 && exec su t"
$ ulimit -c
0
Does this way change the core file limit size temporarily just for the current shell, or permanently for all the shells of all the users or the current user?
Update: The original post https://stackoverflow.com/a/17483998/156458 and 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 bysudo
, so what is the purpose of the command?exec su $LOGNAME"
also doesn't do anything meaningful to make use of the changed limit.
Note: I am focusing on why the above way doesn't work, although there are other ways to get around the problem:
I should put the command which uses the new limit value inside the shell executed by sudo
e.g.
$ sudo sh -c "ulimit -c 1024 && sleep 100" ^\Quit $ ls core
- I could also try to modify
/etc/security/limits.conf
.