
bash_profile to rootĬhown root:root /home//.bash_profileħ) Finally, remove write permissions on the user's.

The syntax is alias vi="vi -Z", but please see this site for more information.Ħ) Change the ownership of the user's. startup_functions_for_beginners.shĥ) Disable shell commands in vi by aliasing the vi command to restricted mode IFS=$'\n' GLOBIGNORE='*' command eval 'COMMANDS_ON_SYSTEM=($(cat. #format and save this information to a bash variable Ls /bin -1 > commands_on_system.txt & ls /usr/bin -1 > commands_on_system.txt #search /bin and /usr/bin for any commands that exist on our system So if you see that in the file, it is not an error.

The [ command is the test command in bash. Running the commands below will search for almost all the commands available on your system and output a ready made file will almost all available commands pre-aliased. You must make sure that the alias alias="printf ''" command is the last command on the list otherwise you lose your ability to alias all of those commands.
#Restricting access to terminal for users on mac osx full
bash_profile file example alias apt-get="printf ''"Īlias vi="vi -Z" #this is vi's safe mode and shell commands won't be run from within viĪ please check the full list of bash commands for more information. bash_profile and add "safe" aliases for all the commands that you would like to disable Rm /home//.bashrc This site has more information as to why it might be a good idea to delete the. All of the directions here assume that users have their own /home/ directory, that their shell is /bin/bash and you would like them to be use the bash shell when they log in to the system.ġ) Change the user's bash to restricted bash mode so that they can't change directories (if you don't have a restricted bash mode on your system, this link will help and give you more information)Ģ) Change directory permissions so that only the user can edit the contents of their home directory I would propose using several different layers of protection to prevent users from running the commands that they shouldn't be allowed to access. I'm going to list one of several possible solutions.

There are lots of different ways that you could achieve this.
