alpriven Posted December 7, 2019 Posted December 7, 2019 Hello there! I have set up an account today to host 2 python bots, and I tried starting them. But when I go to cgi-bin, I get a 403 error. I can view https://alpriven.heliohost.org , and the cPanel. I have checked the permissions and they are 755 (both for cgi-bin and the files). Am I doing something wrong? How can it be that cgi-bin's permissions are 755 and yet I can't access it.Thanks for any help!
vanisk Posted December 7, 2019 Posted December 7, 2019 (edited) Set permission to 644 for files and 755 for folders. (Sorry about that) Check the shebang line in python file for correct location of binary. Edited December 7, 2019 by vanisk
alpriven Posted December 7, 2019 Author Posted December 7, 2019 shebang is #!/usr/bin/python3.7 for all files. And how would downgrading the permissions of files (that I can't even see) help? Especially since they need to be executed, so 644 doesn't even make sense for them.
Sn1F3rt Posted December 7, 2019 Posted December 7, 2019 Actually, the permissions for the file are important, thus even if you're executing the file or whatever, please set it to 644. To set the permissions, go to cP File Manager > public_html > youdomain.com > cgi-bin > Click on the file and on the top-right corner, click on 'Permissions' > Set it to 644 ... and it will work.
vanisk Posted December 7, 2019 Posted December 7, 2019 Try changing shebang to #!/usr/bin/python idk why, but its working for me with the above line and (it gives 500 internal server error on #!/usr/bin/python3.7). I'm on Tommy btw.
alpriven Posted December 7, 2019 Author Posted December 7, 2019 I've changed the permissions of the files inside cgi-bin to 644 (and also cgi-bin is directly in public_html, there's no yourdomain.com folder) an it's still giving a 403 error. And if these really are the correct permissions then https://wiki.helionet.org/Discord_Bot is wrong and should be updated.
vanisk Posted December 7, 2019 Posted December 7, 2019 Tutorial is correct. 755 is the right permission. Try changing shebang line and check if line endings are of linux-style.
alpriven Posted December 7, 2019 Author Posted December 7, 2019 If the problem was with the files (shebang is incorrect or line endings aren't linux-style), then it would probably give a 500 internal server error, rather than a permission denied error.
vanisk Posted December 7, 2019 Posted December 7, 2019 You are right. An admin will look into this and figure out whats the issue. Lets wait.
Luigi123 Posted December 7, 2019 Posted December 7, 2019 This support request is being escalated to our root admin.
wolstech Posted December 7, 2019 Posted December 7, 2019 The cgi-bin folder showing a forbidden message is normal unless you have an index file or specify a file name. The scripts themselves seem to be broken. I switched startdiscord.py back to 3.7 and added a "script start" debug message to http://alpriven.heliohost.org/cgi-bin/startdiscord.py and it shows, so the server is running the script when triggered. Also, be aware the stuff in the bots folder still has dos line endings...
alpriven Posted December 7, 2019 Author Posted December 7, 2019 thank you very much! it switched error messages, so now I actually know what's wrong! But is there an easy way to tell/fix the dos line endings? Obviously if I'm just looking at a file then I can't tell the difference.
wolstech Posted December 7, 2019 Posted December 7, 2019 Notepad++ can do it I believe. There should be an option for line endings or file format. On an iPad at the moment so can't check... If you are using Linux, you can do it in vim, command :set ff=unix will change the file format to Unix line endings.
alpriven Posted December 7, 2019 Author Posted December 7, 2019 Thank you! It no longer gives an error! It still doesn't work though, but I don't think it's because of permissions and so is out of the scope of this thread
Recommended Posts