How to CHOWN file to nobody with putty ssh?


what command i must write in putty ssh to do that, i had search in wiki but still cant find it

i need to CHOWN file.php


thanks for share your knowlege


The “short” answer is that you can’t because on DreamHost only System Administrators can change the owner of a file.

The "long: answer that there is a “workaround”.

From the DreamHost Wiki article on Unix FIle Permissions (under the “User” section):

Every file in Unix is assigned a user. This user is the owner of the file. This user has permission to change the group and mode of the file. No one else (but the administrators) is able to make these changes. Only the administrators can change the owner of a file (there is a work around to this too, though).

This doesn’t make much difference on DreamHost, but if you happen to have administrative access elsewhere, this can be useful knowledge. The command to modify the owner is chown.

$ chown bob file.txt

The user named “bob” now owns “file.txt” (that is, if you’re the superuser, otherwise, this will fail).

The “work-around” to change file owner for non-superusers is to copy the file(s) to a new location as the user you want to own the files. The files will be owned by this user in the new location. It’s not much of a work-around, but it’s occasionally useful.[/quote]
You might also note that there is little to no point in changing a file’s ownership to “nobody” unless you happen to have a user named “nobody”. Unlike many other hosts, apache does not run as “nobody” here. Because of suexec, CGI processes run as your user, not that of apache. Should you be running mod_php, and elect to allow apache to “own” files, that user is “dhapache”.

That said, you can use the workaround described to “chown” files between users on DreamHost systems, but why would you want to copy a file to another location (which you would have to leave world writable) as user “dhapache” anyway?

If you need (or want) to create files owned by the dhapache user, you will have to program that via CGI running as “dhapache”. To do anything with them after creating them, you will need to program/script that action also, or set the permissions for the dir(s)/file(s) sufficiently “loose” to manipulate them with other users. All of that is really another subject.

Why do you want to change a file to being owned by “nobody” and what are you trying to do (possibly avoid accounting or accountability?) :wink: