file-permissions

How to give permission to a directory using command prompt in Windows?

I have to give permissions (Read, Write, Modify) to a user to a directory using command line in Windows. ...

File.Move does not inherit permissions from target directory?

In case something goes wrong in creating a file, I've been writing to a temporary file and then moving to the destination. Something like: var destination = @"C:\foo\bar.txt"; var tempFile = Path.GetTempFileName(); using (var stream = File.OpenWrite(tempFile)) { // write to file here here ...

Securing Wordpress on Apache

Hello, I've just set up a Wordpress blog on Slicehost using Ubuntu Jaunty and Apache. I would like to have a clear overview how to fully secure it. I've read plenty articles on the net but none answers my questions: do I need to create a special user/user group for running wordpress? if yes how I configure Apache, sftp and wordpre...

chgrp permanently for a directory

I'm running a CentOS 5.0 server with root access. The /var/www folder was originally set recursively with root as the owner and group. So I did a chgrp -R webdevs /var/www and a chmod -R g+rwx /var/www command to give all members of the webdevs group read/write access. These changes work as required for all preexisting files. However, ...

Microsoft IIS: how can I change file permissions ?

how can I change file/folders permissions on Microsoft IIS ? Should I use icacls ? Can I use it from ftp ? I'm currently logged in with Microsoft ftp protocol but I get: ftp> icacls ?Invalid command. What's the equivalent of ls -l (to see the permissions) and chmod -R folder +arwx thanks ...

Vista seems to prevent .net from reading/updating file attributes.

Hello everyone! The following function copies a file from Source & Path to Dest & Path, normally setting file attributes to normal before copying. Yet, a user of my app has reported it to fail when copying readonly files, returning a permissions-related error. The user is however running the code as administrator, and the error happens...

How to check if a Windows file is readable/writable?

First off: I know that this isn't reliable for actually checking if I can write. I'm writing a file transfer client, and want feature parity between the "remote" and "local" file browser panes. I fully understand I will have to handle any permission related exceptions for any operation performed regardless; it's not a programming check i...

Best practice for web server user/group permissions

What's the best practice in a secure manner to setup the user/group and permissions? Here's what we currently have; web server runs as www/www. Fastcgi Php runs as www/www. User's shell/ftp account is username/username. We want the user to be able to have full access to all files, including those created by the web server 'www' from ...

How can I locally debug file permission issues in Visual Studio?

I want to debug an ASP.Net website as it attempts to write a file to a directory. When actually deployed this file would possibly not be writeable by the worker process so an error would be thrown, this is not a problem as I just want to catch the error, inform the user and move on. Of course, if I'm debugging on my local machine then ...

CACLS Confusion

During my NSIS setup script for a WinForms app, I use the following CACLS command to give the Users group full rights to a subfolder: Exec 'CACLS "$INSTDIR\SubFolder" /E /T /C /G "Users":F' So in effect the CACLS command executed is something like: CACLS "c:\Program Files\MyApp\SubFolder" /E /T /C /G "Users":F When I then look at t...

Effective file permissions tool's api in windows

Starting from Windows Server 2003, Windows included a new tool which calculates the effective permissions for a user (basically it resolves all groups access and takes care of all "deny" permissions as well). An example in point is that a user A belongs to groups B and C. B has been denied read permissions on a file F, while C has been a...

API to change ownership of file vista

I have a file created by installer as Administrator owner. Is there any API that can change the ownership of file on Vista? ...

Giving write permission to Users group in Vista?

IS there any API that can give 'Users' write permission to a file in Vista? ...

Windows Server 2008 R2 File Permissions

I’m having some problems understanding some particular file permissions behaviour. Here are the steps to reproduce: Log into the server using the default Administrator account Create a text file (testfile.txt) in C:\ProgramData containing some arbitrary text Create a new user account and make it a member of the Administrators group Log...

PHP: Copying file permissions with fileperms and ftp_chmod

The overall goal: Copy the permissions of files from the local filesystem when uploading them over FTP using PHP. The problem: While ftp_chmod appears to succeed, and according to the print statement in the code I'm setting the right permissions, it sets completely wrong permissions. The code: $perms = fileperms($src); if ($perms !==...

How to set file permission for linux host under windows ?

For example, i want a file has permission of 644 automatically when i uploaded it to my linux host, before upload, it is under windows. How could i do this? Btw, i use Filezilla for upload Updated: Before post this question, actually, i ever thought it is impossible too. But, as i has many wordpress sites, i remembered that i never nee...

How to give 'Everybody' full rights to a file (programmatically)

I'm modifying an old C++ program to run on Vista. It does not require Admin privileges. I've changed the code to put logfiles in \ProgramData\MyApp\. These logfiles are written with the stdio functions (fopen, fprintf, fclose). Here's the problem: UserA runs the program first, it creates \ProgramData\MyApp\MyLogFile.txt using Create...

GetEffectiveRightsFromAcl throws invalid acl error

I am trying to get the effective rights a user has on a file using interop in C#. Following is the code I am using : public static FileSystemRights GetFileEffectiveRights(string FileName, string UserName) { IntPtr pDacl, pZero = IntPtr.Zero; int Mask = 0; uint errorReturn = GetNamedSecurityInfo(FileN...

Zend PHP Uploaded File Permission on Windows 7

I have Zend Server CE running on Windows 7. By Default I have Apache running as a Service, Log On as Local System Account. My upload Action saves an uploaded file to its Destination OK, however the permission on the file is set to only SYSTEM, Administrators and IIS_IUSERS. Once uploaded, I cannot open it or move it using PHP. I am us...

Modifying a file from within an executable - permission denied in XP (but not Vista)

I have an application where I need to open an xml file, modify it, and close it again. When I test the code on a laptop running Windows Vista, it works perfectly, but under Windows XP I can't even open the file for read/write access: errno_t _wfopen_s(&inStream, m_fileName, L"r+, ccs = UTF-8"); ...without getting an error code 13, "Pe...