When using commands requiring a TTY (such as Rails console), this script won’t work. So enabling a TTY resolves the issue.