Cannot exec /bin/false: no such file or directory

18,031

Solution 1

Have a look in your shell initialisation scripts for bash, or the screen config file, and see if there's anywhere false is being used with the explicit path /bin/false.

On macOS, the false utility is located in /usr/bin, not in /bin.

Failing that, see if your login shell for some odd reason is set to /bin/false, either by inspecting /etc/passwd or looking at the "Advanced Options" in the "User & Groups" section of the System Preferences (you get these by right-clicking on your user in the list of user accounts, and you may change the shell here too). Someone may have unthinkingly followed a tutorial/HOWTO which sets up a user with /bin/false as their default shell.

When you run screen with sudo you use root's shell/screen init files. This is why that works.

Solution 2

Go to preferences on Terminal and then go to general,then under 'Shell open with' select Command and type bash -l

Share:
18,031

Related videos on Youtube

Em Fhal
Author by

Em Fhal

Updated on September 18, 2022

Comments

  • Em Fhal
    Em Fhal over 1 year

    I'm trying to open GNU Screen with the following command on my Mac OS:

    host:~ user$ screen
    

    The screen terminal opens but quickly dies with the error message:

    Cannot exec /bin/false: no such file or directory

    My terminal is configured to open bash shell on startup. I've tried setting the terminal shell to sh, it gives the same error.

    However, when I execute screen command as sudo, then the command succeeds.

    How do I resolve it for the normal user?

    • Admin
      Admin almost 8 years
      Search for /bin/false in your rc-files (.bashrc, .bash_profile etc.) Also check your .screenrc.
  • Em Fhal
    Em Fhal almost 8 years
    Sorry, pressing enter accidentally posted the incomplete comment. I checked the following files: /etc/passwd and ~/.screenrc. However, it seems my shell was setup with /bin/false as default shell. When I did an "echo $SHELL" it gave "/bin/false". Doing an "export SHELL=/bin/bash" fixed the issue. :)
  • Kusalananda
    Kusalananda almost 8 years
    @sultan.of.swing Good! You should change your default shell in the System Preferences. Also, if this solves your issue, please consider accepting the answer
  • guntbert
    guntbert over 5 years
    Please explain what this does and how it solves the problem.
  • Reb.Cabin
    Reb.Cabin about 5 years
    is that "bash -<Capital Eye>" or "bash-<Uncial Ell>" ?
  • Reb.Cabin
    Reb.Cabin over 4 years
    best answer this is