Prevent cgi-bin directory from being automatically created when connecting via sFTP
This is simply a tutorial on how to prevent cgi-bin directories from automatically being created in the web root directory of your sites when connecting via sFTP. There are no real reasons to do this other than the fact that it's annoying when those directories keep re-appearing! :)
It appears the bashrc file is creating these cgi-bin directories automatically. To stop this from happening, comment out the following lines in /etc/bashrc
Hope that helps other OCD administrators like myself! :D
if [ ! -e ~/public_html/cgi-bin ]; then
mkdir -p ~/public_html/cgi-bin
fiHope that helps other OCD administrators like myself! :D
-
Hello :) Thank you for providing that workaround. We appreciate the input. 0 -
I think this section is added by cPanel, based on where it is in the /etc/bashrc. So I'm assuming it will be recreated when cPanel updates? cPanel what's the reasoning behind forcing the creation of this directory each time a bash session is spawned? 0 -
I have not seen any reports of cPanel overwriting the changes made to /etc/bashrc other than during the initial installation. Thank you. 0 -
Thanks cPanelMichael. It makes sense that a cPanel update would not overwrite /etc/bashrc, and that's a great policy. However, I wonder why is it there in the first place? The initial cPanel installation *seems* to add this to /etc/bashrc (I might be wrong on that). But if so, perhaps it's a legacy thing that should be removed on the next release? I just don't see a reason for automatic, forceful creation of $HOME/public_html/cgi_bin on every login. It even does it for root (because it's in the global bashrc). Why would I ever want a /root/public_html/cgi_bin/ nonetheless, a /root/public_html/ ? It's not a critical issue, but I'm just passing it along in case it needs to be suggested to the devs (maybe you're a part of that team?) . It really seems like a bug at this point. Thanks again for the followup 0 -
Good tip! I saw an issue about some empty domains, probably it is related to the creation of public_html from a cpanel login when public_html it's empty or with the default content. what I see is the change of the group of the folder public_html for user:user when in the creation it is user:nobody note that I am using fcgid_mod but after there is some content that never happen again, another thing is about the user is under root, no reseller just the default. clean empty cgi-bin folders find /home/ -name cgi-bin -type d -empty -exec rmdir {} \;
check the no empty onesfind /home/ -name cgi-bin -exec echo {} \;
this will work for .svn and .cvs folders... take care with rm commands!0 -
[quote="kevinquinnyo, post: 1590711">I just don't see a reason for automatic, forceful creation of $HOME/public_html/cgi_bin on every login. It even does it for root (because it's in the global bashrc). Why would I ever want a /root/public_html/cgi_bin/ nonetheless, a /root/public_html/ ?
This would be a good idea for a feature request: Submit A Feature Request Thank you.0
Please sign in to leave a comment.
Comments
6 comments