I'm a newbie to Linux. I've set up Fedora Core 2 and got Apache working OK. I'm getting the appropriate page on localhost.

Now I want to test Apache for a PHP script I've written with KWrite, but I cannot save a file to /var/www/html because I'm told:

"The document could not be saved, as it was not possible to write to file:/var/www/html/first.php. Check that you have write access to this file or that enough disc space is available."

I know I've got enough disc space.

I go to Konqueror to file:/var/www and right-click on the html folder, then select Properties in the pop-up window.

I click on the tab Permissions, then on Advanced Permissions and get Access Permissions - Konqueror. I cannot get the boxes to change when I click on them. Perhaps I'm still logged in as a user and not as the super user. But Konqueror is not inviting me to enter the root password and I don't know how to make it do that.

I've read the KDE manual, and three books, but I cannot find out how I change this vital directory permission.

Can anyone guide me, please. I want to use a graphical user interface rather than the terminal.

I love Linux and want to use it to build PHP websites that so far I've only built with Windows. My aim is to never have to use a version of Windows beyond XP Pro and to move to Linux completely.

I'm sure I'll be OK once I'm over these early unfamiliarities.

Hello,

Welcome to Linux! There are some things to learn, and you are in for a small challenge, but it is very well worth it, and you will be a happier fella for taking this step.

A FIRST MAJOR STEP you have already made -- you have realized that you should not be running around as the root user for normal day-to-day tasks. Only use Root when you need it. There are weeks that can go by that I have not used the root user operation... if you setup your system properly, and assign the rights correctly, you too can have a peaceful life.

If you are going to really migrate to Linux, you need to learn how to work in the Terminal, the Command Line Interface (CLI).

Look into the launcher bar there for the System Tools --> Terminal. If you are logged in as a normal user, here you can use the "su -" command to promote yourself to being a super-user. Security note: If you want only certain people to have this functionality on your public boxes, you can change the perms so that only a certain group of users can use this command. I have done this for 2+ years with no hiccups.

Ok, so you are in the terminal window. Time for a few commands:

cd Changes the directory
pwd Prints the path of the current directory
chmod Changes the permissions on a file
chown Changes the owner of a file
chgrp Changes the group of a file
ls Lists out the directory file names
ls -l Lists out the directory, in long view, showing permissions on files.

Let's look at some of my files here:

[christian@astro internet]$ pwd
/internet
[christian@astro internet]$ ls -l
total 36
drwxr-xr-x    5 apache   apache       4096 Sep  3 17:47 egroupstore
drwxr-xr-x    5 root     root         4096 Sep  9 00:43 ftp
drwx------    2 root     root        16384 Sep  2 14:13 lost+found
drwxr-xr-x    5 mysql    mysql        4096 Sep  3 17:45 mysql
drwxr-xr-x    3 christian christian     4096 Sep 30 20:54 Temporary Items
drwxr-xr-x    5 root     root         4096 Sep  2 14:36 www

You will see that I have made my own /internet partition outside of /var, and that it has different owner names and group.

Let's look at the www directory.

drwxr-xr-x    5 root     root         4096 Sep  2 14:36 www

d means it is a directory.

The next three letters mean "Read Write eXecute" for the OWNER
The middle three letters are "Read no-thing eXecute" for the GROUP
The last three letters are "Read no-thing eXecute" for the WORLD (public).

If there is a - in the permissions location, that means the priv is revoked.

How do you set permissions? Using chmod *filename* or chmod *dirname*

If you are good with octal numbers, you can change them really easily.

Think of it as

R = 4
W= 2
X = 1

So, if you want RWX (all perms), then 4 + 2 + 1 = 7 (this is common for owner)
Others:

RWX = 7
RW- = 6
R-X = 5 (this is common, you can read, and execute the file, but no write/change)
R-- = 4 (not as common, as it can get funny if you can read but not run)
-WX = 3 (rare / weird)
-W- = 2 (Great for drop boxes... teachers set this up for students to drop homework)
--X = 1 (not as common)
--- = 0 (no access)

So, where are we going with this?

Each number place in the chmod x y z means x for owner, y for group, and z for world.

Your www directory might be

drwxr-xr-x 1 root root 220350 Sep 7 00:16 www

And this means that only the root user can write to the directory (meaning inside the directory) and your user would only be able to read and execute. You would need to do two things.

chmod 775 www

Do an ls -l to see what that did.

Then you need to

chown root.username www

where username is the username you are using to edit your files. Again, do an ls -l to see what you did. If this is a public box where a group of you will be saving information there, then create a groupname, and add yourself to the group, and then chown root.groupname directoryname instead.

You are in effect telling the system that the group of people you specified have permissions to write inside that directory. You left the last digit at 5, so that the outside world can only read the information inside their web browser.

There is another way to do the permissions involving "chmod o=+r-x" and that style... I find the numbers to be much easier. Learn the numbers the first time, and you will be an educated Linux user!

If you need more information, please ask. This post may be long/windy due to the hour.

Christian

commented: Excellent work my friend...you helped this person with fantastic info! :) +1

Hello,

Welcome to Linux! There are some things to learn, and you are in for a small challenge, but it is very well worth it, and you will be a happier fella for taking this step.

A FIRST MAJOR STEP you have already made -- you have realized that you should not be running around as the root user for normal day-to-day tasks. Only use Root when you need it. There are weeks that can go by that I have not used the root user operation... if you setup your system properly, and assign the rights correctly, you too can have a peaceful life.

If you are going to really migrate to Linux, you need to learn how to work in the Terminal, the Command Line Interface (CLI).

Look into the launcher bar there for the System Tools --> Terminal. If you are logged in as a normal user, here you can use the "su -" command to promote yourself to being a super-user. Security note: If you want only certain people to have this functionality on your public boxes, you can change the perms so that only a certain group of users can use this command. I have done this for 2+ years with no hiccups.

Ok, so you are in the terminal window. Time for a few commands:

cd Changes the directory
pwd Prints the path of the current directory
chmod Changes the permissions on a file
chown Changes the owner of a file
chgrp Changes the group of a file
ls Lists out the directory file names
ls -l Lists out the directory, in long view, showing permissions on files.

Let's look at some of my files here:

[christian@astro internet]$ pwd
/internet
[christian@astro internet]$ ls -l
total 36
drwxr-xr-x    5 apache   apache       4096 Sep  3 17:47 egroupstore
drwxr-xr-x    5 root     root         4096 Sep  9 00:43 ftp
drwx------    2 root     root        16384 Sep  2 14:13 lost+found
drwxr-xr-x    5 mysql    mysql        4096 Sep  3 17:45 mysql
drwxr-xr-x    3 christian christian     4096 Sep 30 20:54 Temporary Items
drwxr-xr-x    5 root     root         4096 Sep  2 14:36 www

You will see that I have made my own /internet partition outside of /var, and that it has different owner names and group.

Let's look at the www directory.

drwxr-xr-x    5 root     root         4096 Sep  2 14:36 www

d means it is a directory.

The next three letters mean "Read Write eXecute" for the OWNER
The middle three letters are "Read no-thing eXecute" for the GROUP
The last three letters are "Read no-thing eXecute" for the WORLD (public).

If there is a - in the permissions location, that means the priv is revoked.

How do you set permissions? Using chmod *filename* or chmod *dirname*

If you are good with octal numbers, you can change them really easily.

Think of it as

R = 4
W= 2
X = 1

So, if you want RWX (all perms), then 4 + 2 + 1 = 7 (this is common for owner)
Others:

RWX = 7
RW- = 6
R-X = 5 (this is common, you can read, and execute the file, but no write/change)
R-- = 4 (not as common, as it can get funny if you can read but not run)
-WX = 3 (rare / weird)
-W- = 2 (Great for drop boxes... teachers set this up for students to drop homework)
--X = 1 (not as common)
--- = 0 (no access)

So, where are we going with this?

Each number place in the chmod x y z means x for owner, y for group, and z for world.

Your www directory might be

drwxr-xr-x 1 root root 220350 Sep 7 00:16 www

And this means that only the root user can write to the directory (meaning inside the directory) and your user would only be able to read and execute. You would need to do two things.

chmod 775 www

Do an ls -l to see what that did.

Then you need to

chown root.username www

where username is the username you are using to edit your files. Again, do an ls -l to see what you did. If this is a public box where a group of you will be saving information there, then create a groupname, and add yourself to the group, and then chown root.groupname directoryname instead.

You are in effect telling the system that the group of people you specified have permissions to write inside that directory. You left the last digit at 5, so that the outside world can only read the information inside their web browser.

There is another way to do the permissions involving "chmod o=+r-x" and that style... I find the numbers to be much easier. Learn the numbers the first time, and you will be an educated Linux user!

If you need more information, please ask. This post may be long/windy due to the hour.

Christian

Many thanks.

I did what you explained so clearly - and now I've got my PHP scripts working on Apache.

My confidence with Linux is growing by the day.

I much appreciate your help - just what was needed to launch me into using the Terminal.

Hello,

Welcome to Linux! There are some things to learn, and you are in for a small challenge, but it is very well worth it, and you will be a happier fella for taking this step.

A FIRST MAJOR STEP you have already made -- you have realized that you should not be running around as the root user for normal day-to-day tasks. Only use Root when you need it. There are weeks that can go by that I have not used the root user operation... if you setup your system properly, and assign the rights correctly, you too can have a peaceful life.

If you are going to really migrate to Linux, you need to learn how to work in the Terminal, the Command Line Interface (CLI).

Look into the launcher bar there for the System Tools --> Terminal. If you are logged in as a normal user, here you can use the "su -" command to promote yourself to being a super-user. Security note: If you want only certain people to have this functionality on your public boxes, you can change the perms so that only a certain group of users can use this command. I have done this for 2+ years with no hiccups.

Ok, so you are in the terminal window. Time for a few commands:

cd Changes the directory
pwd Prints the path of the current directory
chmod Changes the permissions on a file
chown Changes the owner of a file
chgrp Changes the group of a file
ls Lists out the directory file names
ls -l Lists out the directory, in long view, showing permissions on files.

Let's look at some of my files here:

[christian@astro internet]$ pwd
/internet
[christian@astro internet]$ ls -l
total 36
drwxr-xr-x    5 apache   apache       4096 Sep  3 17:47 egroupstore
drwxr-xr-x    5 root     root         4096 Sep  9 00:43 ftp
drwx------    2 root     root        16384 Sep  2 14:13 lost+found
drwxr-xr-x    5 mysql    mysql        4096 Sep  3 17:45 mysql
drwxr-xr-x    3 christian christian     4096 Sep 30 20:54 Temporary Items
drwxr-xr-x    5 root     root         4096 Sep  2 14:36 www

You will see that I have made my own /internet partition outside of /var, and that it has different owner names and group.

Let's look at the www directory.

drwxr-xr-x    5 root     root         4096 Sep  2 14:36 www

d means it is a directory.

The next three letters mean "Read Write eXecute" for the OWNER
The middle three letters are "Read no-thing eXecute" for the GROUP
The last three letters are "Read no-thing eXecute" for the WORLD (public).

If there is a - in the permissions location, that means the priv is revoked.

How do you set permissions? Using chmod *filename* or chmod *dirname*

If you are good with octal numbers, you can change them really easily.

Think of it as

R = 4
W= 2
X = 1

So, if you want RWX (all perms), then 4 + 2 + 1 = 7 (this is common for owner)
Others:

RWX = 7
RW- = 6
R-X = 5 (this is common, you can read, and execute the file, but no write/change)
R-- = 4 (not as common, as it can get funny if you can read but not run)
-WX = 3 (rare / weird)
-W- = 2 (Great for drop boxes... teachers set this up for students to drop homework)
--X = 1 (not as common)
--- = 0 (no access)

So, where are we going with this?

Each number place in the chmod x y z means x for owner, y for group, and z for world.

Your www directory might be

drwxr-xr-x 1 root root 220350 Sep 7 00:16 www

And this means that only the root user can write to the directory (meaning inside the directory) and your user would only be able to read and execute. You would need to do two things.

chmod 775 www

Do an ls -l to see what that did.

Then you need to

chown root.username www

where username is the username you are using to edit your files. Again, do an ls -l to see what you did. If this is a public box where a group of you will be saving information there, then create a groupname, and add yourself to the group, and then chown root.groupname directoryname instead.

You are in effect telling the system that the group of people you specified have permissions to write inside that directory. You left the last digit at 5, so that the outside world can only read the information inside their web browser.

There is another way to do the permissions involving "chmod o=+r-x" and that style... I find the numbers to be much easier. Learn the numbers the first time, and you will be an educated Linux user!

If you need more information, please ask. This post may be long/windy due to the hour.

Christian

Hello Guys,

am newly registered in the - hopefully - active forum.

I have a hard disk that contain an old windows directory, i attached to mandrake 10.1 linux, and i can read it very nice...

but i cant delete anything, or write to it ??!!!

chmod, chown,... didnt work
what should i do....?????????

N.B i cant format it to ext3 cuz i need the other directories...

all the best guys...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.