Linux environment variables and user privilege escalation

Shell Classification (four kinds)

In the mentioned Linux环境变量配置文件before, you need to understand the four categories of Shell:

1. Interactive Shell: Interactive mode is executed at the terminal, Shell waiting for your input, and execute the command you have submitted immediately. This mode is called an interactive because the shell interacts with the user. This model is also very familiar with most users: login, execute commands, quit. When you exit, Shell also terminated.

2. Non-Interactive Shell: non-interactive mode, perform to Shell Script (non-interactive) mode. In this mode, Shell does not interact with you, but read commands stored in a file and execute them. When it is read to the end of file EOF, Shell will cease.
Can print "$ -" values of the variables (current option flags representing the shell), the printed result, if there is i, it means that this is an interactive Shell, one of the "i" option (expressed Interactive Shell) to distinguish interaction type and non-interactive Shell.

3. Log type Shell: that requires a user name, password, log in to enter the Shell (or generated by --login "option shell), such as su - root, you newgrp mygroupneed to log the user (group) name, also requires the user (group) password .

4. Non-logon type Shell: No user name, password can enter the Shell, such as sh, bashthe command will open a new direct Bash Shell command window.

Environment variable configuration file

According to 全局/个人classification

Global configuration file

/etc/profile
/etc/profile.d/.sh*
/etc/bashrc

Personal Profiles

/.bash_profile
/.bashrc

According su - [username]to the su [username]classification

su - [username]

Will switch home directory, environment variables loaded configuration file has five.
/ etc / Profile
/etc/profile.d/.sh*
~ / .bash_profile
~ / .bashrc
/ etc / bashrc

su [username]

Not switch home directory, environment variables loaded configuration file has three.
/etc/profile.d/.sh*
~ / .bashrc
/ etc / bashrc

Guess you like

Origin www.cnblogs.com/zzzwqh/p/12617684.html