How would you configure byobu as a login shell?

I need to have my telnet and ssh users use Byobu as their login shell. I would like to avoid using .login/.profile/.bashrc and the likes to spawn Byobu. I'd like to have Byobu as the shell defined in /etc/passwd.

I've already done a few tests, but have been unable to have it working properly. Any idea?


Solution 1:

Byobu is not a shell, per se. It's a program you run within your shell. The utilities, byobu-enable and byobu-disable, put a line at the end of your ~/.profile that launches byobu (if necessary) when you spawn a new login. The wrapper script there does some sanity checking for you and prevents recursion.

Now, that said, I'll tell you how you could do what you're asking to do, but I strongly advise against it. You may well end up in some nasty recursion or infinite loop. Beware!

  1. Set /usr/bin/screen as your login shell in the last field in /etc/passwd.
  2. Put this in your ~/.screenrc:

    source /usr/share/byobu/profiles/byoburc

Solution 2:

This does not answer the details of the question, but the title of it. So, if your problem is that byobu does not source /etc/profile when starting, it can be fixed as follows. In ~/.byobu/.tmux.conf add:

set -g default-command '/bin/bash --login'

This will use bash as login shell, so when starting byobu /etc/profile, will be sourced.

Solution 3:

add this to /etc/profile

echo $- | grep -qs i && byobu-launcher && exit 0

Solution 4:

Before setting the shell, you should probably make sure whatever program you want will work as a shell. "Valid" shells are pre-configured in /etc/shells; if what you want to use as a shell isn't in that list, I would consider carefully whether you want to use it as a shell or not. You could try it with a test user first, to make sure you can login okay using it as a shell.

But on to how to change your default shell.

For individual users, you can change their login shell using the chsh command.

chsh will accept the full pathname of any executable file on the system. However, it will issue a warning if the shell is not listed in the /etc/shells file. On the other hand, it can also be configured such that it will only accept shells listed in this file, unless you are root.

To change the default shell for all users, it will depend on how you add users. For example, if you use the adduser command, you can configure the default shell in /etc/adduser.conf:

$ grep -i dshell /etc/adduser.conf 
# The DSHELL variable specifies the default login shell on your
DSHELL=/bin/bash