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

bashosxshell

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?

Best Answer

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.

Related Question