How to do that? Without PAM on my GNU/Linux OS the number of open files is 1024 by default and cannot be raised above 4096 (via ulimit -n NNNN command) despiting what is written in /etc/security/limits.conf. So, how does it work without PAM and how to set limits in such case?===upd===I decided for myself to use PAM. For those who wants to exceed the hard limit of opened files without PAM, look up for the RLIMIT_NOFILE constant in include/asm-generic/resource.h and INR_OPEN_MAX in include/linux/fs.h which defines the number of 4096 files as hard limit for rlimits. Check also CAP_SYS_RESOURCE which is required to be able to call setrlimit() on a running system to exceed the limit. It seems there is no way to do a system call like setrlimit() in bash, but it may be implemented as a binary executable file. Or you can make a kernel patch.
Setting ulimits without PAM
pam;ulimit
Actually it can, you just need to run the syscall (which is what the ulimit command does) with CAP_SYS_RESOURCE capability.There are two distinct values for every limit: hard and soft. Soft can be raised even by the user up to the hard limit. The hard limit can only be increased with proper privileges (for some resources it cannot be raised over kernel limit). See man getrlimit for more detailed information.The easy way to do it is to run it by root (i.e. along the lines of: su root; ulimit; su user - first become root, from there change limits, and su back to the appropriate user), the secure way is to have a binary that would have just the aforementioned capability set (see man setcap and man capabilities) and proper access rights.In your case, the hard limit is 4096, so you can't go beyond that on your own (as a user).