Monday, May 6, 2024
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 751  / 2 Years ago, wed, december 8, 2021, 8:47:27

Some commands like npm, composer, git, etc are not recommended run as root user. But sometimes I forget to run it when I log in as root, and my coworkers also sometimes do that too. That makes some files/dirs unable to be accessed by non-root users, which sometimes makes our website/apps errors. Is there any way to disable those commands when run as a root user? at least give warning/confirmation before running those commands.


More From » command-line

 Answers
7

You can use aliases to prevent those commands from execution.
for example for preventing command git from execution you can append this line to the file /root/.bashrc:


alias git='echo You are root!'

[#1177] Thursday, December 9, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
altybol

Total Points: 364
Total Questions: 138
Total Answers: 121

Location: France
Member since Thu, May 6, 2021
3 Years ago
altybol questions
;