Page 1/2 for modifying user tools in Linux

Source: Internet
Author: User

1. chfn User Information Modification tool;
The chfn tool is mainly used to change the user's full name, office address, phone number, and so on. The usage is as follows:
Chfn [-f full-name] [-o Office] [-P office-Phone] [-H home-Phone] [-u] [-V] [username]
The simplest method is
Chfn User Name
[Root @ localhost ~] # Chfn beinanlinux Note: Modify beinanlinux information;
Changing finger information for beinanlinux.
Name []: beinan. Linux note: the user's full name is beinan. Linux. Just write one;
Office []: chinadl
Office Phone: 66666666
Home phone []: 99999999
Finger information changed. Note: The change is complete;
How can we know the changes have been made ?? You can use finger or directly view the/etc/passwd file;
[Root @ localhost ~] # Finger beinanlinux
Login: beinanlinux name: beinan. Linux
Directory:/home/beinanlinux shell:/bin/bash
Offices: chinadl home phone: 99999999
Last login sat Nov 5 :27 (CST) on tty2
No mail.
No plan.
Which part of the beinanlinux user in the/etc/passwd file has been modified by chfn ??
[Root @ localhost ~] # More/etc/passwd | grep beinanlinux
Beinanlinux: X: 509: 509: beinan. Linux, chinadl, 66666666,999999:/home/beinanlinux:/bin/bash
Use more/etc/passwd to extract beinanlinux records. Let's take a look at what we marked in the red letter, that is, what we modified through chfn, therefore, we can directly modify the/etc/passwd file to achieve the goal;

2. CHSH changes the shell type;

[Root @ localhost ~] # CHSH -- Help
Usage: CHSH [-s shell] [-- list-shells] [-- help] [-- version] [username]
If CHSH does not contain any parameters or user names, the shell type of the current user is changed by default;
Example:
[Root @ localhost ~] # CHSH -- list-shells Note: List all shells in the current system;
/Bin/sh
/Bin/bash
/Sbin/nologin Note: This is extremely useful because users are not allowed to log on to the system. You can check which users are nologin in/etc/passwd;
/Bin/KSh
/Bin/tcsh
/Bin/CSH
/Bin/zsh
[Root @ localhost ~] # Finger beinanlinux | grep shell Note: view the shell type used by beinanlinux;
Directory:/home/beinanlinux shell:/bin/bash Note: beinanlinux uses Bash;
[Root @ localhost ~] # CHSH-S/bin/KSh beinanlinux Note: Change the shell used by beinanlinux to KSh;
Changing shell for beinanlinux.
Shell changed. Note: The change is complete;
[Root @ localhost ~] # Finger beinanlinux | grep shell Note: query the shell used by beinanlinux again;
Directory:/home/beinanlinux shell:/bin/KSh Note: It seems that it has been changed;
CHSH is still useful. When tejia does not allow users to log on, we can change the user's shell to/sbin/nologin. Most of the virtual users in the system cannot log on to the system, this is extremely important for system security. Use the following command to check which users in the system do not have the logon permission?
[Root @ localhost ~] # More/etc/passwd | grep nologin

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.