An Exploring South African

Things to do in Cape Town, the Helderberg, and the Cape Winelands

Menu

Skip to content
  • About
  • Explore

Ubuntu Server: Block Login for a User Account CodeUnit 21 JUL 2010

Certain user accounts on a Linux system are create with the intention to be used exclusively by some or other service or application. So in order to stop anyone from logging into the machine as that user account, you need to disable the login without disabling the account!

The easiest way to do this is by editing the /etc/passwd to set the user account’s shell to /bin/false instead of the usual /bin/bash.

The recommended way of editing the /etc/passwd file is through the use of vipw which gains an exclusive lock on the file to prevent corruption of the password file through race condition usage.

vipw makes use of vi as its editor, so once it is loaded up, browse through the file to find the user account which you want to edit, switch to the INSERT mode by pressing ‘s’, make your change and return to the command mode by pressing ESC. Enter :exit to close down the editor and save the file.

And that’s all there is to it. Nobody should be able to log in as that system only account! :)

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Pinterest (Opens in new window)

Related

Wednesday 21/07/2010CodeUnitdisable login, login, ubuntu, user account, vipwCraig Lotter

About Craig Lotter

Software developer, husband and dad to two little girls. Writer behind An Exploring South African. I don't have time for myself any more. View all posts by Craig Lotter →

Post navigation

← How to Upgrade Your Ubuntu Server Version over the Network and via the Terminal Ubuntu Server: Figure Out Which Version You Currently have Installed →

An Exploring South African

Curiosity, travel, and discovering new places. Craig Lotter's An Exploring South African is primarily a South African travel blog of things to do in and around Cape Town, the Helderberg, and the Cape Winelands.

Craig Lötter

A South African software developer at Touchwork, Craig Lotter is a husband to a cake baker, father to two young girls, and someone who is constantly looking for new places to explore. He is also not that bad of a writer either.

   

Instagram

Subscribe via Email

Enter your email address to subscribe to this blog and receive notifications of new content via email.

Copyright © 2007-2021 Craig Lotter | Rugged Rock Studio | Proudly powered by WordPress