O'Reilly logo

CompTIA Linux+ Certification Guide by Philip Inshanally

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The usermod command

Earlier we saw that to make any changes we have to remove the user with the useradd command. This can be cumbersome every time we decide on a change; instead, we can leverage another powerful command: the usermod command. The basic syntax of the usermod command is as follows:

usermod <option> username

Using our test user tom, we can change a number of parameters with the usermod command. For example, we can lock the account for the user tom, this will prevent the user tom from being able to log into the system. To lock an account, we would use the -L option:

root@ubuntu:/home/philip# cat /etc/passwdphilip:x:1000:1000:philip,,,:/home/philip:/bin/bashgdm:x:121:129:Gnome Display Manager:/var/lib/gdm3:/bin/falsegeoclue:x:122:130::/var/lib/geoclue:/bin/false ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required