Xin Xing analyzes some issues about user locking in Linux. Xin Xing analyzes linux locking

Source: Internet
Author: User

Xin Xing analyzes some issues about user locking in Linux. Xin Xing analyzes linux locking

Sometimes we need to lock users. There are usually three common methods:

(1) individual users are prohibited from logging on.

For example, to disable the qian user, we only need to use passwd-l qian.

If we want to unlock the qian user, we only need to use passwd-u qian.

(2) modify the configuration file to disable user logon.

For example, if we want to disable the qian user logon, we can change the shell to/sbin/nologin in/etc/passwd.

For example, this line can be changed to qian: x: 501: 501:/home/qian:/sbin/nologin.

(3) Lock all users

For example, to lock all users, we only need to create a/etc/nologin file, so that all users except root cannot log on.

 

If we lock the user qian, we can still use the root user su to qian, because the root permission is so special, but other users, for example, if xin cannot su to qian, it always prompts: su: the password is incorrect.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.