Using removeItemAtPath ho to remove a file in root folder?
is there a way to get the user enter root password and then cocoa deletes the file
any ideas
You need to use Authorization Services for this. See the Authorization Services Guide for full information on how to escalate privileges correctly.
Related
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.
I have a Rails 3 application which has an attachment model and uses Paperclip gem. Everything works fine on development environment but on production server we cannot access any of the images uploaded. The images are in the right folder where they are supposed to be but when I try to reach them on browser I simply get the 404 page.
The upload folder is located under public folder and called "uploads"
I can access this: "app_url/uploads/test.html" which I manually created to see if it works
But I cannot acces this: "app_url/uploads/test.jpg" which I upload within the application via Paperclip.
I can guess this has something to do with the server configuration but I'm not an expert and may need help about it.
Thanks
UPDATE
I've just realised that uploaded files belong to "nobody" and when I manually change the owner to "root" it seems to be working fine. So I need to find a way to tell Paperclip make the files belong to "root"
It's not a good idea to have a web application being able to write files as root. File permissions are derived from the process writing the files. In case you're using Passenger, there's the concept of user switching:
http://www.modrails.com/documentation/Users%20guide%20Apache.html#PassengerDefaultUser
Upon startup of your app, Passenger tries to figure out which user owns those files, and tries to switch it's application process to that user. In case it fails, "nobody" is the default.
Check your application permissions on the file level. You should have one user account per application on your server. The application (the directory and contents above the public directory) should be owned by this user. Files under public should be readable by others, so the webserver can pick them up, too.
Are you using Capistrano for deployment?
I need the app open with admin privileges always in mac, windows e ubuntu. Is there a way to specify this in the XML description file?
I needed this permission to write to the database. I discovered that it is right to point to the temporary directory that is created in the user system folder, instead of pointing to the installation folder.
im working with cms made simple.my problem is my template folder permission.in this cms when a template uploaded,a folder (by the same name of that temlate,for example : 'TEMP1') creates and it's permission is set to 0755.when i want to change permission of the template folder i will get this error :
FileOp Failure on: /home/visamast/public_html/uploads/arty1: Operation not permitted
and also when i want to upload files via ftp or cpanel to this folder nothing will happen,i mean the upload process will be done,but no files has been uploaded!!!!!!!!
how can i fix this problem?!
It sound like you are having an ownership problem rather than a permission problem. If your server is set up to run PHP as a module, files and directories created by PHP will be owned by the generic Apache user. Generally that means that you will not be able to change permissions on the file/directory. Most likely you will need to have your hosting company do a recursive chown on the entire directory tree your site is in to make you the owner of all of the files and directories.
My application (vb.net) sometimes throws an "access denied" exception when attempting to delete files in the AppData folder and I'm not sure why.
I confirm that the file exists before attempting to delete it and have not done anything to make it readonly, etc.
The interesting thing is that it seems to go okay when I'm logged in with Admin rights. However, I thought that the AppData folder did not require admin rights.
Any help would be greatly appreciated!
Thanks!
My gut instincts without seeing your code is that maybe you have this file opened in your program or in another program?
Maybe these files were created when you launched your application being logged on as Admin? So you get this error when you try to delete them later as normal user.
It is not necessarily the folder, but the Owner of the file you are trying to interact with. If the File is owned by Administrators, you may have problems.
AppData is a protected hidden folder because it is meant for your applications to store Local, LocalLow and Roaming application related data. This is why you would get prompted with a UAC prompt when you try to head into the folder and it is also hidden from view.
Try to use the Privilege demand attribute in your code to request process elevation to access the folder.