Bugzilla – Bug 242
When run from a shell with ulimits enabled; sudo inherits ulimits when run as root
Last modified: 2007-04-24 14:18:06 MDT
A rather contrived example: antarus@kyoto ~ $ ulimit -v 10000 antarus@kyoto ~ $ sudo gaim gaim: error while loading shared libraries: libpangoft2-1.0.so.0: failed to map segment from shared object: Cannot allocate memory antarus@kyoto ~ $ When switching from UserA to UserB I can see some merit in keeping ulimits enforced; but enforcing ulimits on root serves no real purpose.
Sudo's pam config file should include pam_limits.so which allows system-wide and per-user limits to be specified (including root) in /etc/security/limits.conf. If nothing is specified there then the current limits will be passed on to the program executed by sudo. As far as I can tell, sudo's behavior is consistent with what happens when you su to root.