Can't copy file to Apache

Hello,

I have recently setup an Apache server and i am unable to copy a index.html file to the directory to check if it worked.

It says error, then something about “i don’t have permissions”.

This is my first time on SUSE so please excuse any rookie behaviour :wink:

Thank you.

Ryan.

The owner of the directory where you want to put the file is probably root (or possibly apache). To put the file there, you have to become superuser.

If you’re in KDE, the easiest way to do that is to use System -> File Manager (Superuser Mode).

Another way to do it is to be a member of the group for the directory where your Web pages will go (using File Manager (Superuser), once again). Right-click on the folder and check the permissions and ownership. Then use Yast -> User Management to make sure that you are a member of that group as well. One common approach is to use the group “wheel” or “apache.” Make sure anyone in the group can write to that directory and you’re covered.

DO NOT give in to the temptation to make that directory world-writable (ie, anyone can write to it). DO NOT make that directory a member of the “users” group, either. This is a security feature built in to Linux. It’s a pain when you’re copying files, but it makes it much, much more difficult for a Bad Guy to tamper with your pages, too. :slight_smile:

RyRobbo wrote:
> I have recently setup an Apache server and i am unable to copy a
> index.html file to the directory to check if it worked.
>
> It says error, then something about “i don’t have permissions”.

This is because you don’t have permissions. Usually, the package
apache2-example-pages should be installed, which includes a sample
“It works!” page.

Kind regards,
Andreas Stieger

Thank you guys,

I thought that if i added my account to the “root” group it would work but it never… so i will now add it the groups suggested, thank you.

Im using GNOME by the way.

Ryan.

I DON’T recommend that you add yourself to the “root” group. That could give a potential attacker way too much privilege, should he come into the machine as you.

I’m a little confused, though. Maybe someone who’s more familiar with Apache on Opensuse could pitch in, but most distros install it under a neutral user and group name (typically “apache”).

Unless you built it from source … ?

Oh NO! It isn’t to complicated. Adding yourself to the root group will lead to mysterious error, and they are leading by default to a reinstall.
Have you tried this:


sudo chown <username>:users -R <apache directory>

replace the <username> with your username, and the <apache directory> with the patch to the apache directory (/srv/www/htdocs?).

Ok ill unadd myself from the root group, and try that command line.

Sorry i havn’t posted my results, i will give all the help a go on monday.

Thanks to everyone who has helped me.

Ryan.

Also, i never built apache from source…i don’t know how to with all the makefile etc… haha.

I had it installed on my machine from one of the packages off the DVD version.

That’s the smart way to go. I don’t understand people who try to compile from source or bring in a foreign LAMP stack when it’s all provided in openSUSE if you know where to look in YaST.