Linux study notes (4)-Linux user management

Source: Internet
Author: User
1. the two most important files of the user account are/etc/passwd and/etc/shadow. you can view them using man5passwd. In/etc/passwd: separate 7 parts, respectively: account name, password (displayed as x indicates that the password has been moved to the shadow encrypted file )...
1. the two most important files of the user account are "/etc/passwd" and "/etc/shadow". you can view them using man 5 passwd. In/etc/passwd, ":" is separated into seven parts: account name and password (displayed as x indicates that the password has been moved to the encrypted file shadow ), UID, GID, user information description bar, home directory, and Shell login (for example, if you want the user to log on directly to vi, change the shell directly to/usr/bin/vi ). In/etc/shadow, ":" is separated by nine fields: account name and password (if the first character in this column is * OR !, Indicates that this account is not used for logon.) the date of the last password change, the number of days the password cannot be changed, the number of days the password needs to be changed again, and the warning period before the password change period, password Expiration Time, account expiration date, and retention. 2. what if I forget the root password? Start Linux in a variety of feasible ways, such as the maintenance mode for a single user, or use Live CD to enter the Linux system. then, mount the hard disk smoothly and then enter the/etc/shadow file, clear all the root password columns. Then log on to Linux, and then the root user can log on without a password. Finally, use passwd to set the root password. 3. view the group of valid and initial user groups, and switch to newgrp. 4. useradd is added to Linux account management. for the default values, see/etc/default/useradd. for the user's home directory, see/etc/skel /*, for more information about password and UID/GID settings, see/etc/login. defs. Set user data usermod and delete user userdel. If you want to completely delete an account, you 'd better use "find/-user username" to find the username file in the system before executing userdel-r username, and then delete it. 5. switch user identity su-use root environment settings parameter file-l username use username environment settings parameter file sudo this is to allow the user to "enter your own password", refer to/etc/sudoers. We recommend that you use mongodo to edit the/etc/sudoers file, because mongodo will check the internal syntax of/etc/sudoers. To use sudo without a password, you can change it to "username ALL = (ALL) NOPASSWD: ALL ". 6. when the/etc/nologin file exists, any normal identity account will only obtain the/etc/nologin content when attempting to log on, but cannot log on to the host. 7. query User: w, who, last, lastlog user conversations: talk, mesg, wall 8. routine commands at only perform one task assignment atq and atrm to view and delete the tasks to be executed at cron. routine commands executed by cron are recorded in/var. /log/cron. Crontab-e (edit)-l (view)-r (delete, note that this will delete all jobs, use cron-e when deleting a job) for commands that you want to execute every day and hour, you can view/etc/crontab. 9. job Management: & place the command in the background and execute [Ctrl]-z. place the "current" job in the background and pause jobs to observe the current background job status. fg takes the background job to the foreground for processing. bg lets the job run in the background. kill management background job 10. dmesg view the message in the starting process 11. the execution sequence of a process is PRI (new) = PRI (old) + nice. the smaller the PRI, the higher the priority of the process. PRI is generated dynamically by the system, it is not a fixed value. The nice value is generally 0 ~ 19. the available nice value of root is-20 ~ 19. Starting the execution process immediately provides a specific nice value, using nice commands such as nice-N-5 vi. Adjust the nice value of an existing PID, and use the renice command to adjust the nice value of top. Note that the entire nice value can be passed between the parent process and the child process. 12. for details about the/proc file system, refer to man5 proc. Specifically,/proc/cmdline loads the relevant parameters of kernel execution, and you can view this file to learn how the system starts. 13. The fuser is used by the file or device to find the process that uses the file or device. lsof queries the file opened or used by a process. the file and the PID creator hopezhangbo of the device pidof queries a process.
Related Article

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.