So, I have made a little shell script in PHP with some basics functions (ls, cat, etc..) and I'd like to use it as my default shell.

But since I don't want to do a mistake, I have some questions: If I change the /etc/passwd file and say that my shell is now /bash/myshell.php, will it work? Does the file need to be in /bin, or would something like /Downloads/myscript.php work?

I'm running Debian 8

  • It should work, but the most simple way to see it, it is to add a new user and to do your attempts with the new user. (keep always at least one user with a standard shell). Check the attributes of, for example, /bin/bash with the new one (` /bash/myshell.php`), and who you will be in your shell... – Hastur Feb 3 '16 at 13:15

Your new shell should be listed in /etc/shells (by root). Users can then use chsh to change shell. You can store executables in /bin, on other filesystems that depends on the mount options.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.