Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-09-2003, 09:01 AM   #1
Registered: Jul 2003
Location: San Luis Obispo, CA
Distribution: Gentoo 2007.0
Posts: 88

Rep: Reputation: 15
Unhappy 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
Old 07-18-2003, 04:09 AM   #2
LQ Guru
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
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).



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
sed overwrite schneidz Programming 8 09-21-2005 02:56 PM
can we overwrite the permissions of folder/file zameer_india Linux - Networking 0 09-30-2004 01:11 AM
Copy and Overwrite jrdioko Linux - Newbie 2 06-29-2004 11:46 AM
FTP Overwrite/Delete Problems CPUguy387 Linux - General 4 09-24-2003 08:42 PM
Can't overwrite MBR Elmo Linux - General 2 03-13-2003 01:24 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:18 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration