title: BSD - write(1) uid's
body: <p>In bash, <code>write(1)</code> takes in <code>user</code> as an arg and then takes input to send to <code>user</code> as a message. When trying it out myself I can run</p>
  <pre><code>user$ write $USER
  // Message from user@ubuntu on pts/1 at 12:34 ...
  </code></pre>
  <p>at which point <kbd>Enter</kbd> delimited input is echoed back to <code>user</code></p>
  <p>As a test, I ssh'ed into <code>user</code> in a separate window then executed</p>
  <pre><code>user$ sudo su user2
  user2$ write user
  // write: you are uid 1003, but your login is as uid 1001
  </code></pre>
  <p>I expected to start writing to <code>user</code></p>
  <h1>Questions</h1>
  <p>How does <code>write(1)</code> know I am logged in as a different user?</p>
  <p>Can I login with <code>sudo</code> so that my uid's are the same?</p>
  <p>Where are the different uid's stored? Is it sudo_uid vs uid maybe?</p>
  <p>Thank you !!</p>