Skip to content
TheChatArchiveThe Chat Archive
o3-2025-04-16· OpenAIHugging Face LMArena Human Preference 140K

mac CLI. I want to run screen but I get "screen Cannot open your terminal '/dev/ttys002'…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with DeepSeekdeepseek-r1-0528’s answer.
  1. User

    mac CLI. I want to run screen but I get

    "screen Cannot open your terminal '/dev/ttys002' - please check."

    why ?

    context: I want to use a user, not root. /dev/ttys002 belongs root. I am connected via ssh

  2. Assistant

    screen needs read-/write access to the controlling terminal (the device you see in the error message).
    If the device is not owned by you – or you are not root – it refuses to start and you get:

    Cannot open your terminal '/dev/ttys002' - please check.
    

    Why is the tty owned by root?

    Typical scenario:

    1. You ssh in as root (or someone in the wheel group).
    2. Then you su otheruser (or sudo -u otheruser …).
      ‑→ You changed your UID, but the tty is still owned by the account that logged in first (root).
      ‑→ otheruser now lacks permission to open /dev/ttys002.

    You can confirm it:

    $ who am i
    bob     ttys002  Jun 21 12:34
    $ ls -l /dev/ttys002
    crw--w----  1 root  tty  0x0200003 Jun 21 12:34 /dev/ttys002
    

    root owns the device, group is tty, and normal users are neither root nor in group tty.

    ──────────────────────────────────────────────── How to solve / work-around ────────────────────────────────────────────────

    Choose whichever fits your workflow best.

    1. Log in as the target user directly

      ssh otheruser@host     # the tty is created with correct ownership
      screen                 # works
      
    2. Give the user a fresh pseudo-tty inside your current session

      su - otheruser         # or sudo -u otheruser -i
      script -q /dev/null    # instant new pty that *is* owned by otheruser
      screen                 # now works
      

      Exit script with when you’re done with screen.

    3. Run screen set-uid root (traditional way)
      On many Unix systems screen is installed setuid-root so it can always open a tty.
      Homebrew/macOS ships it without the s-bit for security reasons. If you trust your users:

      sudo chmod u+s /usr/local/bin/screen      # or wherever screen lives
      

      Now any user can start screen regardless of the tty owner.
      (Understand the security implications before doing this.)

    4. Temporarily chown the device (root only)

      sudo chown otheruser /dev/ttys002
      

      Works but reverts on logout/login and is seldom worth the trouble.

    ──────────────────────────────────────────────── TL;DR ──────────────────────────────────────────────── screen fails because the tty device belongs to root after you used su.
    Either log in as the correct user from the start, create a new pty with script, or install screen setuid-root.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.