Changing user's shell with salt

I used salt to change the user shell to /usr/bin/fish using salt. However, I had the surprise that the template stopped working.

I switched back to /bin/bash and it still didn’t work. Finally, using another Qubes OS I was able to compare my fedora-38 templates, user should also be in qubes group. But my salt code should only change the user’s shell, not its groups.

So, now, I’m wondering, does the user exist at all in the fedora template, or is it created at each boot? :thinking: I would like to understand why I got the issue in the first place.

The salt code (which works because it adds the groups)

user:
  user.present:
    - shell: /usr/bin/fish
    - groups:
      - user
      - qubes

The path should be /usr/bin/bash not /bin/bash

That’s curious because bash path of user in the stock fedora-38 template is /bin/bash, but I also tried /usr/bin/bash and it didn’t worked either.

edit: Both paths are listed in /etc/shells

You are right, /bin/bash should work, it’s also the path used in /etc/passwd on Debian.

I wrote an introduction to this one

but that doesn’t help the topic…

1 Like

@de_dust2 your post seems a bit unrelated. Sure, it’s about a shell. If you could, instead of just dropping a link, please add some context as to why that link is relevant to the discussion. And if it’s not, then maybe reconsider the reply.

2 Likes

@deeplow for sure. Fish shell did some nice innovation around usability. For many newcomers that got into Unix-like systems within just the last few years, Fish is a good recommendation. NuShell brings some modern innovations that are pretty great, and also some usability aspects that are very Fish-like.

fish is a pretty good default for a non-root user, so is nu.

The OP wasn’t asking about what shells people prefer though, so this kind of recommendations are still off-topic.

For reference:

I guess the only way to figure that would be to mount the template disk in dom0 and look at /etc/passwd

No.
I always find it useful to run qubesctl --show-output - if you do
you will see that user.present when setting shell sets the group too.
This confirms what you saw.

This is a known salt bug which has already been fixed.

1 Like