Where is Safe Place to Save File In Virtual Host Cpanel - cpanel

I will develop website that saving documents in Cpanel. If I save documents in public html people just access through http://example.com/file.doc document will get accessed.
Where do I put documents so only my web application can access the documents?
Is it right to place the documents in directory before public_html?
Thank you.

Yes, You need to save that files outside the public_html directory.
OR you can create password protect directory for your documents so that nobody can access that without user name and password
Please check it at : https://documentation.cpanel.net/display/1140Docs/Password+Protect+Directories

Related

Block the user from viewing files in the directory via the url

I'm pretty new in developing for VB.NET. I have a web application and I want to block the access to the files in a directory.
For example:
If the user access the following page: application.com/example/page.aspx
If the user remove the page name and type "application.com/example/", he will see all the files inside the folder "example".
I want to block this possibility and, when a user try to access the files, redirect to an error page.
I know how to solve this in PHP through htaccess, but I have never done it by VB.NET. Any help?
If you are using IIS then
Go to your sites-->Desired Site
From Features Views Select Directory Browsing disabled.
web.config or .htaccess will do.
Remember it is a security risk to have directories open for anyone to see.

Get public url from file path in dropbox

Suppose I have dropbox account, and I have shared folder their, for instance the name of the shared folder is "SampleFolder". And inside that folder I have folder and file hierarchy, which also is shared being inside a shared folder. How can I having SampleFolder url and knowing the file path that I want to download easily get it's url either by Dropbox Core API or just know the way the urls are constructed and construct the url by hand. For instance I want to download file in path SampleFolder/Folder1/Folder2/image.png, how can I get the url of that file knowing only the url of SampleFolder? Let me note that I don't want to login into dropbox, here there is a get method for retrieving file by it's path, but it requires authorisation. Basically I want a public place of storing files, and in my code downloading them by their urls.
Thanks for the answers.
[Addition Aug2017: This method has been disabled by Dropbox for all users. See https://www.dropbox.com/en/help/files-folders/public-folder]
See https://www.dropbox.com/help/16/en towards the bottom under "Creating a Public folder"
While newer accounts do not have the Public Folder enabled, it is possible to enable it by going to this link when logged into that account: https://www.dropbox.com/enable_public_folder
Then you can follow the path to the file after https://dl.dropbox.com/u/<user id>/
This used to be possible with Dropbox, at least in the spring of 2012, but it appears no longer to work. Before, if you had a shared folder, you could browse the subcontents of that folder relative to the shared URL, but now, all the subcontents have distinct absolute URLs.
Breaking basic UNIX file path conventions like this is a huge loss in functionality, in my opinion.
Set your link permission to anyone with a link.
try the following link to access it as public static file:
https://dl.dropboxusercontent.com/s/<docId>/yourfile.ext
docId can be found by clicking on Share button of the doc on the dropbox UI.
This the alphanumeric string found after /s/.
Unfortunately, no, this isn't currently possible in an official or supported way. These shared links don't offer any metadata or API for access like this.
For free users, the Public Folder method for relative paths won't work anymore now. See here.
As of March 15, 2017 the Public folder in your Dropbox account has been converted into a standard folder. By default this folder is private to your account. This transition will occur automatically.

Adding .htaccess to disallow sites/default/files directory from any access

Customers at my site upload private files using node checkout module which finally land in sites/default/files directory as part of their order.
Unfortunately I could never find a way till now to restrict those files to the owners only. I've even used User File module, but this module stopped my site.
Customer can upload files as their product order even as anonymous but to checkout they will need to login.
So if I add .htaccess in this directory disallowing everybody in the world read access, will this idea work?
I was thinking to write a hook so that as soon as a product is checked out, it's associated uploaded file can be moved to some private location, or have it's read permission removed( as hosting is on linux).
Any ideas?
I'm using Drupal-6

Access error uploading file using winsp

I am trying to upload two files to a webserver so my teacher can see it. I am using winsp since my filezila doesnt work. But for some reason it is telling me that i don't have access to that page. Can anyone tell me why is it doing that.Here is a picture of my screen.
I am just not understanding why it is telling me that i don't have to access it.
If I had to take a guess, that public_html folder is your public directory where you should put things that anybody can get to (like through a browser). You have your files outside of that directory, so your page can't access them.
edit:
It's an educated guess, as I have seen a fair amount of server configurations that name the public web folder as such (other common names are "www" and "httpdocs")
Problem definitly isn't in code. There is error while uploading files. Can you connect to FTP regulary? If you can. Look for Active or Passive file transfer to FTP. Also if you can upload files, files must be in public_html folder to be visible from browser.
Active or passive
First read Neal comment.
second, you should probably copy the files into the /public_html folder, instead of the / (root) folder.

change default page in cpanel

What do I need to do to change the default page in cpanel?
Update or create .htaccess file in the public_html folder and make the following content..
DirectoryIndex index.php home.php
If you are referring to the default apache cPanel page then you will need whm access for that
WHM >> Main >> Account Functions >> Web Template Editor
Here you can change the default page, suspended page etc.
Assuming you are referring to the default page when an account is created, this is easily done by creating an index.html or .php page within your /etc/skel folder (assuming you have a VPS or dedicated server).
There is a setting within WHM that allows for it in case you are not CLI savvy.
Hope this helps, sorry for the delayed response, but I'm new and trying to build my rep up!
You can create custom branded login pages for cPAnel and WHM by using the advanced branding features of cPanel. cPanel also supports custom login pages for each reseller's accounts. Linked Below is the documentation.
http://docs.cpanel.net/twiki/bin/view/AllDocumentation/WHMDocs/CustomBrandedLoginPages
how to create cpanel default page for hosting domains.
create default html page and upload the files in Skeleton Directory on cpanel root domain.
http://www.motherhost.in/members/knowledgebase/22/how-to-change-default-page-in-cpanel.html
The skeleton directory ( Skeleton Directory: A directory that defines what files and subdirectories new accounts will have by default. When the account is created, the new user’s account will contain an exact copy of the skeleton directory.) exists to let you easily copy the same files into every new account’s public_html and public_ftp directories when the account is created.
Keep in mind that:
When a visitor accesses http://example.com, he will see the contents of example.com 's public_html directory.
When a visitor accesses http://example.com/subdirectory, he will see the contents of public_html/subdirectory.
Contents of the public_ftp directory are available for anonymous FTP users to download.
This WHM feature simply states the location of the skeleton directory (/root/cpanel3-skel).
To set up your skeleton directory:
These files will be accessible to the new user via an FTP client.
Decide what kind of default setup you would like your new users to have.
Place the appropriate subdirectories and HTML files in /root/cpanel3-skel/public_html.
These files will be copied to new accounts’ public_html directories when accounts are created.
Place the appropriate FTP-related files in /root/cpanel3-skel/public_ftp.
These files will be accessible to the new user via an FTP client.