title: Check if command was run directly by the user
body: <p>Say I want to change the behavior of <code>kill</code> for educational reasons. If a user directly types it in the shell, then nothing will happen. If some other program/entity-who-is-not-the-user calls it, it performs normally. A wrapping if-statement is probably sufficient, but what do I put in that <code>if</code>?</p>
  
  <p><strong>Edit</strong> I don't want to do this in the shell. I'm asking about kernel programming.</p>
  
  <p>In <a href="http://lxr.free-electrons.com/source/kernel/signal.c?v=2.6.33#L2296" rel="nofollow">line 2296</a> of the kernel source, <code>kill</code> is defined. I will wrap an if statement around the code inside. In that statement, there should be a check to see whether the one who called this was  the user or just some process. The check is the part I don't know how to implement.</p>
  
  <p><strong>Regarding security</strong></p>
  
  <p>Goal:  </p>
  
  <ul>
  <li>Block the user from directly calling <code>kill</code> from any shell  </li>
  <li>Literally everything else is fine and will not be blocked</li>
  </ul>