Linux - NewbieThis 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!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.