Demand:
Login to the Linux host via SSH, the host can only execute specific scripts or programs, how to constrain?
First configure/ETC/BASH.BASHRC The file will be executed each time the new shell is opened;
Add the Execute script or program path to the BASH.BASHRC file;
For a script or program, you cannot have a statement that exits the program, and it should remain in the script or program in exceptional cases.
such as adding
Python3 ~/my_python_project/my_jump/main/main.py
To BASH.BASHRC, each time a shell is started, only the corresponding Python code is executed. Note To open the file with root privileges.
Appendix
The role of other bash profiles
/etc/profile: This file sets the environment information for each user of the system, and the file is executed the first time the user logs on. and collects the shell settings from the configuration file of the/ETC/PROFILE.D directory.
/ETC/BASHRC: Executes this file for each user running the bash shell. When the bash shell is opened, the file is read.
~/.bash_profile: Each user can use this file to enter shell information dedicated to their own use, when the user logs on, the file is only executed once! By default, he sets some environment variables to execute the user's. bashrc file.
~/.BASHRC: This file contains bash information dedicated to your bash shell, which is read when you log in and every time you open a new shell.
~/.bash_logout: Executes the file each time it exits the system (exiting the Bash shell).
In addition, the variables set in/etc/profile (global) can be applied to any user, while the variables set in ~/.BASHRC, etc. (local) only inherit variables from/etc/profile, they are "parent-child" relationships.
This article is from the "Kaman" blog, make sure to keep this source http://3155037.blog.51cto.com/3145037/1959706
The gateway to the terminal in the Linux system