LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 01-06-2008, 05:20 PM   #1
girtart3d
Member
 
Registered: Jan 2008
Posts: 46

Rep: Reputation: 15
getting really frustrated with file permissions.


when i try to delete something using the terminal it says i dont have permission. when i try to change the permissions it say i dont have permission. when i go to the file properties it says that only the owner can change permissions. i AM the only owner. and it says user-root and group - my name. im not a group im the user... can someone explain this please?
 
Old 01-06-2008, 05:25 PM   #2
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
possibly you might not have permission to write in the directory the file is in? just a guess...

can you show us the output of
Quote:
ls -l
of the folder and the file you want to delete
 
Old 01-06-2008, 05:27 PM   #3
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
The permissions are set up so that files can only be deleted or changed by their owner. If you want to change or delete files owned by root then you have to be root. How you establish yourself as root varies from one distribution to another. You can log in as root, use the su command, or use the sudo command. Which one(s) you use depends on how your distribution has set it up. All of these methods require you to enter the root password before you can have root authority. What distribution are you using?

------------------------
Steve Stites
 
Old 01-06-2008, 05:28 PM   #4
girtart3d
Member
 
Registered: Jan 2008
Posts: 46

Original Poster
Rep: Reputation: 15
i get this

total 0
drwxr-xr-x 2 elaine elaine 232 2008-01-05 00:26 Computer
drwx------ 2 elaine elaine 80 2008-01-05 00:33 Desktop
drwxr-xr-x 5 elaine elaine 152 2008-01-05 00:26 Documents
drwxr-xr-x 2 elaine elaine 112 2008-01-06 13:05 Incomplete
drwxr-xr-x 2 elaine elaine 80 2008-01-05 00:26 Network
drwxr-xr-x 2 elaine elaine 48 2008-01-06 12:47 Shared
-rw-r--r-- 1 elaine elaine 0 2008-01-06 01:36 wget-log
-rw-r--r-- 1 elaine elaine 0 2008-01-06 01:37 wget-log.1
-rw-r--r-- 1 elaine elaine 0 2008-01-06 01:38 wget-log.2
-rw-r--r-- 1 elaine elaine 0 2008-01-06 01:39 wget-log.3
 
Old 01-06-2008, 05:29 PM   #5
girtart3d
Member
 
Registered: Jan 2008
Posts: 46

Original Poster
Rep: Reputation: 15
umm. i dont know. i just know im using freespire 2.0
 
Old 01-06-2008, 07:31 PM   #6
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
Quote:
i AM the only owner. and it says user-root and group - my name. im not a group im the user... can someone explain this please?
A file can be accessed by three types of users:
- the owner of the file
- a member of the group tot which the owner belongs
- others = everyone else
These three are often abbreviated as u, g and o. Note that the first (u) is a bit confusing, since it stands for "owner", not "user". Similarly, o is not "owner" but "others".

If you look at the output of ls -l, you will see that every file is preceded by something like:

rwxr-xr-x

This can be split up into three parts of 3 characters each:
user rwx
group r-x
others r-x

These letters indicate the sort of permissions that people have:
r = read permissions
w = write permissions
x = execute permissions
Each of these can also be represented a a number:
r = 4
w = 2
x = 1
Thus, the permissions of a user can also be expressed by adding up the numbers:
r (=4) an w(=2) and x (=1) amounts to 7. r (=4) and x(=1) amounts to 5.
Thus, rwxr-xr-x can be written as 755. rwxrwxrwx is 777. Etc.

Now, in our example (rwxr-xr-x), the owner can read, write and execute. The group and others have only r and x, meaning that they can read and execute but not write (absence of a type of permission is indicated by a - in the relevant position). If everyone had all permissions, one would have rwxrwxrwx instead.

The meaning of "read", "write" and "execute" is different for files and directories.
Applied to a file:
read = permission to read the contents of a file
write = permission to edit a file (does not include permission to delete or create a file!).
execute= permission to run a file
Applied to a directory:
read = permission to list the contents of a directory
write = permission to rename, delete or create files in the given directory
execute=permission to read files in the given directory and to list the contents of its subdirectories

Whether you are looking at a file or a directory is also indicated by the output of ls -l: a d in the first position means "directory", - means "file".

But who controls the permissions that apply to a file or a directory? The owner. If you are the owner, you can decide which permissions will be given to yourself, to people who are in your group and to any others. For example, if you are the owner and you have a file with rwxr-xr-x permissions but you want only yourself and your group to be able to do anything with the file, you can withdraw all permissions from "others" with the chmod command like this:
chmod 750 [file_name ] i.e. rwxr-x---
Note that you may also need to change the permissions that apply to the directory that the file is in since these also have their part to play.

This also shows why there are three types of users (wouldn't it be enough to have just an owner and then everyone else?): there can be only one owner for a file or a directory so if we didn't have "group", it would be owner versus all the rest, which would be awfully inconvenient. Suppose that you are working on a file with a number of people but you don't want anyone else to have access. You would then withdraw all permissions from "others". But that would mean that only the owner now has permissions. Farewell team work. Fortunately, you can use the concept of a group: you just put the other team members in your group and you can then give them permissions that can be different from those that apply to the owner and those that apply to "others". Thus, if you want your team members to be able to read,write and execute, you add them to your group and then you set the permissions on the file to look like this: rwxrwx--- (command: chmod 770 filename). If they can only read and execute: rwxr-x--- (command: chmod 750 filename). Again, bear in mind that some permissions that apply to a file are determined by the permissions that are set for the directory. You always have to consider both.

In short, if there is a file you can't delete, you should check the permissions that apply to the directory it is in. If you see rwxr-xr-x root root, it means that its owned by root and that members of group root have read and execute permissions on the contents of that directory (as have "others": rwx r-x r-x). In this case, there are two reasons that you can't delete files: first of all, you most likely don't belong to group "root" (that would be insecure) and secondly, even if you did, you would have r and x only, not the w that is required to create, delete and rename files. So the solution is to give yourself the permissions that root enjoys. Just open up a terminal and type su - and then the root password. You now are root and you can delete all that you want - providing that root has w permissions on the directory in question! But since root can do anything, root can also assign itself w permissions when required. Just bear in mind this may create insecure situations without careful planning. When you are done working as root, just type exit and you are returned to regular user status.

Some distributions do not use su - (Ubuntu comes to mind) but sudo. In that case you simply precede your command with the magic "sudo" word. Thus sudo rm file will remove file "file" that you wouldn't otherwise have permissions to delete. Sudo makes things more straightforward but not all distributions can use it out of the box.

Final caveat: if you find yourself reaching for su or sudo all the time, there is something wrong. Files and directories that require special permissions are simply not meant to be accessed by the user, at least not on a regular basis. The only time this it is required is when you need to edit system configuration files. All your other work should be done in your home directory, where you are free to do with files what you want.

Last edited by jay73; 01-06-2008 at 07:42 PM.
 
Old 01-06-2008, 09:55 PM   #7
girtart3d
Member
 
Registered: Jan 2008
Posts: 46

Original Poster
Rep: Reputation: 15
thanks. i did the root thing to delete stuff.
 
Old 01-06-2008, 10:05 PM   #8
Boow
Member
 
Registered: Feb 2004
Distribution: Slackware 10.2
Posts: 669

Rep: Reputation: 32
Quote:
Originally Posted by girtart3d View Post
when i try to delete something using the terminal it says i dont have permission. when i try to change the permissions it say i dont have permission. when i go to the file properties it says that only the owner can change permissions. i AM the only owner. and it says user-root and group - my name. im not a group im the user... can someone explain this please?
Try doing that in windows you cant even access files as admin or system when perms get screwed up. I've run across the totally undelete able file that could only be deleted from a bootable repair cd.
 
Old 01-06-2008, 11:12 PM   #9
marciobarbalho
Member
 
Registered: Dec 2007
Location: Brazil
Distribution: slackware 13
Posts: 151

Rep: Reputation: 30
keep it simple:

create a common user and do login into the system. Before using, you problably should type this as root:

root# chmod -R 755 /home/username
 
Old 01-07-2008, 09:32 PM   #10
girtart3d
Member
 
Registered: Jan 2008
Posts: 46

Original Poster
Rep: Reputation: 15
i solved it already. but thank you all.
 
Old 01-08-2008, 04:41 AM   #11
LlNUX
Member
 
Registered: Oct 2007
Location: Sydney, Australia
Distribution: Debian
Posts: 63

Rep: Reputation: 15
http://www.linuxconfig.org/Chmod
 
  


Reply



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
file permissions OK, but command permissions? stabu Linux - General 2 10-05-2005 12:00 PM
Frustrated, file permissions sharing files sporks Linux - General 9 04-20-2005 08:37 PM
locking a usage policy file/ftp file permissions gbow Linux - Newbie 0 02-16-2004 05:35 AM
CVS - file permissions and file ownership Osten Linux - Software 3 01-18-2004 04:08 PM
Changing file permissions on a SAMBA file share apenney Linux - Software 0 02-11-2002 04:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:59 AM.

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