LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   2 problems with permissions/overwrite (https://www.linuxquestions.org/questions/linux-newbie-8/2-problems-with-permissions-overwrite-71258/)

CPUguy387 07-09-2003 09:01 AM

2 problems with permissions/overwrite
 
I'm running an Apache server with the folder /wwwroot. I'm having trouble with basic file permissions and overwrites.

Logged in as root, whenever I try to place new files in a directory, they are only CHMODed to 600, when I usually need 644 or 755 to run the files on my site. Is there any way to make a default so I don't have to go back and CHMOD every file?

Also, whenever I copy a folder from another directory to my server, it replaces the entire directory and files, not just the files in that directory. For instance, if I had the folder 'stuff' with 5 items in it and I copied over another folder 'stuff' with 1 new item, the folder on the site now reads as 'stuff' with one item.

I know these are probably stupid questions, but I really can't figure out what's wrong. Does it have something to do with being logged in as root? Thanx

MasterC 07-18-2003 04:09 AM

Being logged in as root will always be something you should do as a last resort. You are better off finding the least priviledged user necessary to carry out any task. When you are moving files around, try to use cp as often as possible, this way you are less likely to overwrite something also, use the -i with everything you move or copy:
cp -ia /path/to/files/* /path/to/other/files
Should only copy the files to the location 'files' without overwriting, notice the /* that is probably what you are missing in your calls. The -i means to prompt for each copy. This may seem tedious, but you shouldn't be moving/copying that many files THAT often for it to become cumbersome.

As for your chmod, you can either set the sticky bit on the directory (not a great idea IMHO) or you can setup a cron job to change the permissions on the directory (probably a bit better, but be careful with your syntax).

Cool


All times are GMT -5. The time now is 11:35 PM.