Getting ‘chsh’ in Fedora 24 Server + How to Find Which Package Provides a Command

I’m currently in the process of migrating all of my development projects to individual VMs on my KVM server, so I can maintain my session regardless of what happens with my client machines. As per usual, I set up a VM using a regular ISO-based image of Fedora 24 Server, since I normally run Fedora Workstation on most machines I develop on.

I also have a script that sets up my development environment on Fedora, by getting all of the software I normally work with, which relies on some built-in capabilities of Fedora, including the ability to change shells. Unfortunately, Fedora 24 Server excludes ‘chsh’ from the default image.

Fortunately, there is a simple solution to this:

sudo dnf install util-linux-user

That’s it. But since I couldn’t find which package chsh was included with by quickly Googling the command, there was a bit of work left for me to do myself. A bit more searching led me to discover an awesome feature of rpm that tells me exactly what package I need, however.

From an RPM-based system that has the command available (in this case, my Fedora 24 Workstation system) use:

# Generic Form
rpm -qf `which COMMAND`
# Finding chsh
rpm -qf `which chsh`

If the command is provided by an RPM package, then rpm will return the name of the package that provides the command. You then can install the package via dnf or yum and be on your way.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.