title: ssh remote command execution and ulimit
body: <p>I have the following script:</p>
  
  <pre><code>cat &gt; /tmp/script.sh &lt;&lt;EndOfScript
  #!/bin/sh
  ulimit -n 8192
  run_app
  EndOfScript
  </code></pre>
  
  <p>which runs smoothly locally, it is always ok. But if I try to run it remotely through ssh:</p>
  
  <pre><code>scp /tmp/script.sh user@host:/tmp/script.sh
  ssh user@host "chmod 755 /tmp/script.sh; /tmp/script.sh"
  </code></pre>
  
  <p>I got the error: </p>
  
  <pre><code>ulimit: open files: cannot modify limit: Operation not permitted
  </code></pre>
  
  <p>I also tried the following command:</p>
  
  <pre><code>ssh user@host "ulimit -n 8192"
  </code></pre>
  
  <p>same error.</p>
  
  <p>It looks like that ssh remote command execution is enforcing a 1024 hard limit on nofile limit, but I can not find out how to modify this default value. I tried to modify /etc/security/limits.conf and restart sshd, still the same error.</p>