The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Which folder should contain my bash scripts

Discussion in 'General Discussion' started by genesearch, Oct 13, 2016.

  1. genesearch

    genesearch Registered

    Joined:
    Oct 13, 2016
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    1
    Location:
    AU
    cPanel Access Level:
    Root Administrator
    I am using a VPS host, with Cpanel/WHM so I have full control.
    On one of the hosting accounts, which is a live website, I have created some bash scripts to run some admin tasks at set times using cron.

    The Help desk at the provider is insisting I should have these scripts located in the /public-html folder, and I think they are nuts, but they wont listen to me.

    They said that I can secure the script locations, but thats not the point. If I make a human error and expose my scripts to the internet it can cause me problems. By putting my scripts into the home/ folder, then there is zero risk.

    Who is right, them or me?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you provide more information about what the bash script does? Is it purely for account-specific tasks or does it require the manipulation or use of system-level files that only the "root" user has access to?

    Thank you.
     
  3. genesearch

    genesearch Registered

    Joined:
    Oct 13, 2016
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    1
    Location:
    AU
    cPanel Access Level:
    Root Administrator
    Thanks

    account specific tasks, which is why I place the bash script in the relevant home directory. i have a few different ones but one is for emailing a log file and then delete that file.

    No action on system files and no root required
     
  4. torrent4all

    torrent4all Member

    Joined:
    Oct 19, 2016
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    YOu can place bash scripts in your home folder /home/your_username. That is good option
     
    genesearch likes this.
  5. iso99

    iso99 Well-Known Member

    Joined:
    Jan 5, 2011
    Messages:
    87
    Likes Received:
    2
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    If it's a script executed by a non-root user, /home/username is a good place.
     
    genesearch likes this.
  6. genesearch

    genesearch Registered

    Joined:
    Oct 13, 2016
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    1
    Location:
    AU
    cPanel Access Level:
    Root Administrator
    so do you all agree that placing bash scripts in home/username/public_html/ is not recommended?
     
  7. aanbar

    aanbar Member

    Joined:
    Jan 1, 2012
    Messages:
    8
    Likes Received:
    5
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    public_html should only contain files you want to serve to people; everything else should be outside public_html

    Anything you want to access through command line or cron should not be in public_html directory
     
    genesearch and linux4me2 like this.
  8. genesearch

    genesearch Registered

    Joined:
    Oct 13, 2016
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    1
    Location:
    AU
    cPanel Access Level:
    Root Administrator
    Thanks, thats what I have been telling tech support.
    Just needed someone to confirm I was on the right track
     
    cPanelMichael likes this.
Loading...

Share This Page