Posted: . At: 5:59 PM. This was 10 years ago. Post ID: 7697
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.

How to change the shell for a user on a Linux system easily with the usermod command.

I recently created a new user with the adduser command.

homer@deusexmachina:~/Documents$ sudo adduser jimkirk
Adding user `jimkirk' ...
Adding new group `jimkirk' (1002) ...
Adding new user `jimkirk' (1002) with group `jimkirk' ...
Creating home directory `/home/jimkirk' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
Changing the user information for jimkirk
Enter the new value, or press ENTER for the default
	Full Name []: 
	Room Number []: 
	Work Phone []: 
	Home Phone []: 
	Other []: 
Is the information correct? [Y/n] y

Now I wanted to change the users shell. I used the usermod command to change this.

homer@deusexmachina:~/Documents$ sudo usermod -s /bin/sh jimkirk

Now the user has a different shell. This is an easy way to change your own shell as well as modifying another user on your computer system.

homer@deusexmachina:~/Documents$ sudo grep /bin/sh /etc/passwd
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
speech-dispatcher:x:110:29:Speech Dispatcher,,,:/var/run/speech-dispatcher:/bin/sh
jimkirk:x:1002:1002:,,,:/home/jimkirk:/bin/sh

1 thought on “How to change the shell for a user on a Linux system easily with the usermod command.”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.