Question: How can lsof report more open files than what ulimit says is the limit?

```
prod_web3(i-ca0b05aa):~$ sudo lsof | wc -l
4399
prod_web3(i-ca0b05aa):~$ ulimit -n
1024

```

Answer: 
From the ulimit builtins man page

```
The ulimit builtin provides control over the resources available to the shell 
and to processes started by it on systems that allow such control.

```

Your `lsof` command lists all of the open files for all processes for all users on the system. You are not comparing like with like.
A bash(1) builtin, ulimit defines the maximum number of open files per process.

This is not a system-wide setting in any way.