title: how do i claim a low-numbered port as non-root the "right way"
body: <p>I have a script that I want to run as a daemon listening on a low-numbered port (&lt; 1024)</p>
  
  <p>Script is in python, though answers in perl are also acceptable.</p>
  
  <p>The script is being daemonized using <a href="http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&amp;chap=4" rel="nofollow noreferrer">start-stop-daemon</a> in a startup script, which may complicate the answer</p>
  
  <p>What I really (<i>think</i>) don't want is to type ps -few and see this process running with a "root" on it's line.</p>
  
  <p>How do I do it?  </p>
  
  <p>( from my less-than-fully-educated-about-system-calls perspective, I can see 3 avenues,</p>
  
  <ol>
  <li>Run the script as root (no --user/--group/--chuid to start-stop-daemon), and have it de-escalate it's user after it claims the port </li>
  <li>Setuid root on the script (chmod u+s), and run the script as the running user, (via --user/--group/--chuid to start-stop-daemon, the startup script still has to be called as root), in the script, acquire root privileges, claim the port, and then revert back to normal user</li>
  <li>something else i'm unaware of</li>
  </ol>
  
  <p>)</p>