Linux User Logon configuration file Summary

Source: Internet
Author: User
System Configuration File: global configuration file: etcprofile, etcprofile. d *, and etcbashrc local configuration file :~. Bash_profile ,~. Bashrc ,~ Bash_logoutprofile class: Role: ① set the environment variable ② run some commands to be executed by the user to log on bashrc class: Role: ① set the alias ② set the system configuration file when the user logs on:
Global configuration file:
/Etc/pro File,/Etc/profile. d/*,/etc/bashrc
Local configuration file:
~ /. Bash_profile ,~ /. Bashrc ,~ /Bash_logout

Profile class:
Purpose: ① set Environment Variables
② Run the user login to execute some Command

Bashrc class:
Purpose: ① set an alias
② Set local variables

Shell classification:
Interactive Logon shell: a shell that logs in as a user and enters the Command Format
The order in which the configuration file is read:
/Etc/profile -->/etc/profile. d/* --> ~ /. Bash_profile --> ~ /. Bashrc -->/etc/bashrc
Non-interactive logon shell: runs automatically only in one script without user logon.
The order in which the configuration file is read:
/. Bashrc -->/etc/profile. d /*
Therefore, when configuring a configuration file File TypeSelect the profile type or bashrc type, and then select an appropriate file based on the shell type, and the configuration file's read Sequence Based on the objects targeted by the configuration file, then you can achieve the desired results.
To reload the configuration file without restarting or logging on again, run the following two commands:
Source FIlename (not recommended)
. FIlename

Exercise:
1. Let the user log in and display "Hello, nice to meet you, I know your name" and know the user name, it also warns users that the consequences of illegal activities are very serious. First, this is for users, so select the global configuration file. Second, it is executed when users log on, therefore, select the profile file, which is then displayed when the user logs on. Therefore, the file is locked in the interactive logon shell. You can select the/etc/profile file according to the file execution sequence, of course, you can also select/etc/profile. d. Next I will set vi/etc/profile in/etc/profile and add the following sentence: Then load the configuration file, the effect is as follows: when other users log on, the same information is displayed:
 

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.