1833871 Members
1792 Online
110063 Solutions
New Discussion

Setting core size to 0

 
SOLVED
Go to solution
dictum9
Super Advisor

Setting core size to 0


I have a system which constantly dumps core (an older version of sshd apparently does) and as a temporary solution, I would like to set core size to 0 so it's never generated, what's the command in .profile?
5 REPLIES 5
Steven E. Protter
Exalted Contributor
Solution

Re: Setting core size to 0

shalom,

ulimit -Sc0

In .profile.

It will prevent core files altogether.

Don't do it system wide or to the oracle user because oracle needs them turned on for diagnosis of problems with the database and application server products.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
dictum9
Super Advisor

Re: Setting core size to 0

Can I do it as root? the root user is creating core files, since sshd is running as root.

James R. Ferguson
Acclaimed Contributor

Re: Setting core size to 0

Hi:

Yes, the ulimit works for 'root', too. You can test this by doing:

# ulimit -Sc 0
# cd /tmp
# ls -l core
core not found
# sleep 60 &
[1] 27379
# kill -abrt 27379
# ls -l core
-rw------- 1 root sys 0 Oct 25 15:46 core
[1] + Abort sleep 60 &

...note the 0-size core file that is created instead of a "normal" large one.

Regards!

...JRF...
Heironimus
Honored Contributor

Re: Setting core size to 0

For a daemon like sshd you probably want to add the ulimit to the init script. The profile won't be sourced by init scripts.
Bill Hassell
Honored Contributor

Re: Setting core size to 0

As mentioned, sshd doesn't login as root (so it never uses .profile), it is simply started during bootup with a start/stop script. You need to add ulimit -c 0 to the sshd start/stop script in /sbin/init.d. Note that option -S (soft) limit isn't meaningful for a daemon as there is no one to change the ulimit value after sshd is started.


Bill Hassell, sysadmin