If you are using Linux and you got the permission error, you will need to raise the allowed limit in the /etc/limits.conf
or /etc/security/limits.conf
file (where the file is located depends on your specific Linux distribution).
For example to allow anyone on the machine to raise their number of open files up to 10000 add the line to the limits.conf
file.
* hard nofile 10000
Then logout and relogin to your system and you should be able to do:
ulimit -n 10000
without a permission error.