LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Keep getting "Permission Denied" when trying to write files (https://www.linuxquestions.org/questions/debian-26/keep-getting-permission-denied-when-trying-to-write-files-140978/)

dunnd40 02-01-2004 08:51 AM

Keep getting "Permission Denied" when trying to write files
 
I just installed Debian and am brand new to this. When I go into vi editir and create a file, I cannot save it. I get "permissions denied". I understand that there are read-write privledges assigned for each directory, but:

1) I don't know how to assign them or check them

2) I thought that I would be able to at least write to my home directory, but I cannot write to any directory

jtshaw 02-01-2004 10:25 AM

ls -la will show you a list off all the files and there permissions.

It'll look like this:
-rw-r--r-- 1 root root 488 Jan 22 09:24 temp

Now I am going to break this down for you, first with permissions.
There are 10 bits to the permissions, first bit (- in my example) is the suid bit. If this is set (it'll say s instead of -) then when a user with permission to the file uses it they use it as if they are the owner. The next three bits (rw-) in the example are the rwx permissions for the files owner. The next three after that (r--) in the example are the rwx for members of the group the file belongs to. The last three (r--) in the example are the rwx for all other users. So in this case temp can be read and written by the owner, read by any member of the group, and read by all other users. We will ignore the 1 for now, the first label, root, is the owner of the file. The second, also root, is the group the file is in. The next number is the size in bytes. After that is the date it was last written to. And the last thing is the name of the file.

To change permissions you must be the owner of the file, or have privileges to it (root has privileges to all files). chmod is the command to change permissions, type man chmod to see how that works.

jtshaw 02-01-2004 10:29 AM

Oh ya, and about that first 1, that is the number of items that link to the file. Linux file systems (ext2, ext3, reiserfs, ect.) support linking at the file system level. See the man page on ln to understand more about linking.


All times are GMT -5. The time now is 11:25 AM.