The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
not able to delete a file dr46014 UNIX for Dummies Questions & Answers 1 05-14-2008 10:51 PM
Delete the first 20k from 76k file dave043 Shell Programming and Scripting 11 02-14-2008 02:29 PM
how to delete record in file data with index in another file? zhynxn Shell Programming and Scripting 0 07-06-2006 12:03 AM
i want to delete a file based on existing file in a directory srivsn Shell Programming and Scripting 3 04-11-2006 04:38 AM
Get file from source server and delete the ftp file lweegp Shell Programming and Scripting 3 10-17-2005 02:53 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-17-2006
tphyahoo tphyahoo is offline
Registered User
  
 

Join Date: Apr 2006
Posts: 24
Why can't I delete this file?

I want to delete the file "b" as hartmantest user.

It has write permission for the "users" group, and this user is a member of that group. So, why can't I delete this file?

Code:
$ ls -l
total 0
-rw-rw-r-- 1 hartman users 0 2006-07-17 16:21 b
-rw-r--r-- 1 hartman users 0 2006-07-17 16:21 c
$ whoami
hartmantest
$ groups
users dialout video
$ rm b
rm: cannot remove `b': Permission denied
$
  #2 (permalink)  
Old 07-17-2006
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,952
check for the permissions of the directory in which the file resides

the directory should have write and execute permission, then only file under the directory can be deleted
  #3 (permalink)  
Old 07-17-2006
Hitori's Avatar
Hitori Hitori is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2006
Posts: 360
Quote:
Originally Posted by matrixmadhan
check for the permissions of the directory in which the file resides

the directory should have write and execute permission, then only file under the directory can be deleted
x - search for files in directory
w - add/delete files
so w is enough (you can delete files although you cannot search for them)

plz. correct me if I'm wrong
  #4 (permalink)  
Old 07-17-2006
reborg's Avatar
reborg reborg is offline Forum Staff  
Administrator
  
 

Join Date: Mar 2005
Location: Ireland
Posts: 4,209
Quote:
Originally Posted by Hitori
x - search for files in directory
w - add/delete files
so w is enough (you can delete files although you cannot search for them)

plz. correct me if I'm wrong
Incorrect, even if you happen to know the name of the file you want to delete.

This ia an extract from an article by Perderabo in the Tutorials Forum.
Quote:
Originally Posted by Perderabo
What do r w and x really mean for a directory?

A directory is a file too, and "read" permission means you can read it. But you really cannot do very much without x permission as well. With directories, you usually have both read and execute permission or neither. On a directory, that x is officially called "search permission". You need x to use a directory in a pathname. So if you try "cat /etc/passwd", you will need x on / and /etc. You also need x to cd into a directory.Suppose you have read but not search (x) permission on a directory. What can you do? Not much. You can use "ls" to view the file names. Even "ls -l" will not work. Read access without search permission is not very useful. Still that is better than having only write permission on a directory...that is completely useless. I have not seen any other documentation that states this explicitly, so let me repeat it: write but no execute permission on a directory grants nothing at all.Suppose you have search (x) permission but no read permission on a directory. Now you can open files in the directory if you happen to know the file's name. You can cd into the directory. And that is it. You cannot even create a new file. Adding write permission will allow you to create files. And you can then delete files if you happen to know their name.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:22 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0