Help - Search - Members - Calendar
Full Version: gaining permission in /var/ directory
MandrivaUsers.org > Advanced Topics > Security
harisp
I'm not sure that this is the right place to post this, but I'm trying to set up a server using 2007 version. I have apache installed and all the html files are in /var/www/html/ but when I try to edit any files or add something in that directory it's telling me that the directory is not writeable. The user that is logged in should have all root and su permissions, but it still won't let me do it.

It's also giving me problems with installing mysql.

Any help would be appreciated.


[moved from Software by spinynorman]
ianw1974
What user were you logged in as? No user has root privileges by default and it is not wise to give a user root privileges either. Should your system be compromised, it's much easier for them to do lots of damage.

Files in /var/www/html by default are either owned by root or apache. Sometimes, apps require that apache own the files, so that the config files can be modified, for example - installing joomla. If you want to edit the files as root, you can do this:

In gnome:

CODE
gksu program /var/www/html/filename.ext


in KDE:

CODE
kdesu program /var/www/html/filename.ext


for example. Or from command line:

CODE
su (enter root password when prompted)
program /var/www/html/filename.ext


if you want to edit using vim/nano or whatever.

MySQL will also have to be installed as root, and then you need to assign a password using mysqladmin to ensure that the root user within MySQL is protected - as by default is doesn't have a password.

If you're still having problems, please explain in more detail what you are trying to do/achieve, and then we can provide more specific instructions to help.
SilverSurfer60
Welcome to MUB.
Ian has beaten me to it so I'll just leave the welcome.
harisp
All I'm trying to do with that directory is put html files. I'm logged in as admin with access to all the directories but I cannot write to it. If i'm using an editor like NVU i cannot save to there? Is there a simple way to do so?

Also with MySql I'm installing it through the console so i do log in as su and put in the correct password and all but when I try to run the line /scripts/mysql_install_db it just tells me that I cannot create the tables.

Thanks for the help
ianw1974
If you're using nvu, then use the command I suggested with gksu in Gnome and kdesu in KDE before you launch nvu. Then it will run nvu as root, rather than your whole system being able to access root privileges.

Alternatively, change the ownership of /var/www/html to admin and then admin can save there.

CODE
chown  -R admin:admin /var/www/html


it's important that R is upper-case to ensure folders are recursively selected and owner-rights reset.

Where did this mysql script come from? How are you trying to run this script, and what is the contents of this script?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.