cgray1223
asked on
unix permissions
Hello,
I copied over a directory (LATEST) into a directory that I created on a linux server. I now want to delete the LATEST directory and all directories below it, but I'm getting a permission denied. Is there any way to delete these directories or does my user id lack sufficient privileges to do so?
drwxrwxr-x 3 colgray eng 4096 Nov 1 16:00 LATEST
dr-xrwxr-x 4 colgray eng 4096 Nov 1 16:00 bin
dr-xrwxr-x 2 colgray eng 12288 Nov 1 16:00 doc
dr-xrwxr-x 2 colgray eng 4096 Nov 1 16:00 include
dr-xrwxr-x 2 colgray eng 4096 Nov 1 16:00 lib
dr-xrwxr-x 2 colgray eng 4096 Nov 1 16:00 mapi
dr-xrwxr-x 2 colgray eng 4096 Nov 1 16:00 ref_agent
I copied over a directory (LATEST) into a directory that I created on a linux server. I now want to delete the LATEST directory and all directories below it, but I'm getting a permission denied. Is there any way to delete these directories or does my user id lack sufficient privileges to do so?
drwxrwxr-x 3 colgray eng 4096 Nov 1 16:00 LATEST
dr-xrwxr-x 4 colgray eng 4096 Nov 1 16:00 bin
dr-xrwxr-x 2 colgray eng 12288 Nov 1 16:00 doc
dr-xrwxr-x 2 colgray eng 4096 Nov 1 16:00 include
dr-xrwxr-x 2 colgray eng 4096 Nov 1 16:00 lib
dr-xrwxr-x 2 colgray eng 4096 Nov 1 16:00 mapi
dr-xrwxr-x 2 colgray eng 4096 Nov 1 16:00 ref_agent
ASKER
that is the user I'm logged in with. When I try that command I get permission denied
Are you sure there's not stuff inside that directory that doesn't belong to colgray?
Try "ls -lRt LATEST" and see if you see files owned by other users.
Try "ls -lRt LATEST" and see if you see files owned by other users.
It is not the permission of LATEST that matters. It is the permission of the folder that holds LATEST. What is the permission of the folder where LATEST is located?
ls -ld ..
ls -ld ..
@farzanj:
You are of course correct that permissions on the parent folder override, but the author says that "I copied over a directory (LATEST) into a directory that I created on a linux server." If the author created the folder, and copied the folder LATEST into it, then the author should technically own that parent directory.
You are of course correct that permissions on the parent folder override, but the author says that "I copied over a directory (LATEST) into a directory that I created on a linux server." If the author created the folder, and copied the folder LATEST into it, then the author should technically own that parent directory.
You could try
$ rmdir LATEST
just to see what error message it produces (and tell us).
$ rmdir LATEST
just to see what error message it produces (and tell us).
you must check the permission of parent directory
$ ls -ld .
$ ls -ld .
ASKER
$ ls -ld . returned drwxrwxr-x 3 userName eng 4096 Nov 1 16:00 dirname
$ rmdir LATEST returned rmdir: `LATEST': Directory not empty
The problem is pointed out by xterm, when I run $ ls -lRt LATEST I get a ton of files and directories, below are some examples
-r--rwxr-- 1 colgray eng 7067 Nov 1 16:00 tree.html
dr-xrwxr-x 4 colgray eng 4096 Nov 1 16:00 bin
dr-xrwxr-x 2 colgray eng 4096 Nov 1 16:00 lib
I did a cp -R when copying over, so did it maintain the permissions from the location I copied it from? Any ideas on how to remove all directories and files under the LATEST directory?
$ rmdir LATEST returned rmdir: `LATEST': Directory not empty
The problem is pointed out by xterm, when I run $ ls -lRt LATEST I get a ton of files and directories, below are some examples
-r--rwxr-- 1 colgray eng 7067 Nov 1 16:00 tree.html
dr-xrwxr-x 4 colgray eng 4096 Nov 1 16:00 bin
dr-xrwxr-x 2 colgray eng 4096 Nov 1 16:00 lib
I did a cp -R when copying over, so did it maintain the permissions from the location I copied it from? Any ideas on how to remove all directories and files under the LATEST directory?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It sounds like the parent directory permissions may have changed after you copied the files?
> $ ls -ld . returned drwxrwxr-x 3 userName eng 4096 Nov 1 16:00 dirname
So, did you purposely change what shows as "userName" and "dirname" above before posting this?
> $ ls -ld . returned drwxrwxr-x 3 userName eng 4096 Nov 1 16:00 dirname
So, did you purposely change what shows as "userName" and "dirname" above before posting this?
ASKER
yes, the actual parent directory that contains the LATEST dir (one I'm trying to delete) is exactly below, ignore that first bullet.
$ ls -ld . yields - drwxrwxr-x 3 colgray eng 4096 Nov 1 16:00 .
$ ls -ld . yields - drwxrwxr-x 3 colgray eng 4096 Nov 1 16:00 .
Can you please do the commands below and paste the full output here?
pwd
rm -rf LATEST
ASKER
$ pwd
/aut/ew/colgray
$ rm -rf LATEST
rm: cannot remove `LATEST/toolkit/bin/Linux/ RefAgent.s h': Permission denied
rm: cannot remove `LATEST/toolkit/bin/Linux/ RefAgent': Permission denied
rm: cannot remove `LATEST/toolkit/bin/Linux/ MgmtApiTes t.sh': Permission denied
rm: cannot remove `LATEST/toolkit/bin/Linux/ MgmtApiTes t': Permission denied
rm: cannot remove `LATEST/toolkit/bin/WinXP/ RefAgent.e xe': Permission denied
rm: cannot remove `LATEST/toolkit/bin/WinXP/ MgmtApiTes t.exe': Permission denied
rm: cannot remove `LATEST/toolkit/include/En ergyWiseAp i.h': Permission denied
rm: cannot remove `LATEST/toolkit/include/En ergyWise.h ': Permission denied
rm: cannot remove `LATEST/toolkit/include/En ergyWiseLo g.h': Permission denied
rm: cannot remove `LATEST/toolkit/include/En ergyWiseSd k.h': Permission denied
rm: cannot remove `LATEST/toolkit/include/En ergyWiseUt il.h': Permission denied
rm: cannot remove `LATEST/toolkit/include/pl atform_typ es.h': Permission denied
rm: cannot remove `LATEST/toolkit/lib/CiscoE nergyWiseA pi.dll': Permission denied
rm: cannot remove `LATEST/toolkit/lib/CiscoE nergyWiseS dk.dll': Permission denied
rm: cannot remove `LATEST/toolkit/lib/libCis coEnergyWi seApi.so.1 .3': Permission denied
rm: cannot remove `LATEST/toolkit/lib/libCis coEnergyWi seApi.so.1 ': Permission denied
rm: cannot remove `LATEST/toolkit/lib/libCis coEnergyWi seApi.so': Permission denied
rm: cannot remove `LATEST/toolkit/lib/libCis coEnergyWi seSdk.so.1 .3': Permission denied
rm: cannot remove `LATEST/toolkit/lib/libCis coEnergyWi seSdk.so.1 ': Permission denied
rm: cannot remove `LATEST/toolkit/lib/libCis coEnergyWi seSdk.so': Permission denied
/aut/ew/colgray
$ rm -rf LATEST
rm: cannot remove `LATEST/toolkit/bin/Linux/
rm: cannot remove `LATEST/toolkit/bin/Linux/
rm: cannot remove `LATEST/toolkit/bin/Linux/
rm: cannot remove `LATEST/toolkit/bin/Linux/
rm: cannot remove `LATEST/toolkit/bin/WinXP/
rm: cannot remove `LATEST/toolkit/bin/WinXP/
rm: cannot remove `LATEST/toolkit/include/En
rm: cannot remove `LATEST/toolkit/include/En
rm: cannot remove `LATEST/toolkit/include/En
rm: cannot remove `LATEST/toolkit/include/En
rm: cannot remove `LATEST/toolkit/include/En
rm: cannot remove `LATEST/toolkit/include/pl
rm: cannot remove `LATEST/toolkit/lib/CiscoE
rm: cannot remove `LATEST/toolkit/lib/CiscoE
rm: cannot remove `LATEST/toolkit/lib/libCis
rm: cannot remove `LATEST/toolkit/lib/libCis
rm: cannot remove `LATEST/toolkit/lib/libCis
rm: cannot remove `LATEST/toolkit/lib/libCis
rm: cannot remove `LATEST/toolkit/lib/libCis
rm: cannot remove `LATEST/toolkit/lib/libCis
ASKER
the permissions on those files look like
-r-xrwxr-x 1 colgray eng 132 Nov 1 16:00 RefAgent.sh
-r-xrwxr-x 1 colgray eng 132 Nov 1 16:00 RefAgent.sh
ASKER
OHUPE's suggestion worked:
-r-xrwxr-x 1 colgray eng 132 Nov 1 16:00 RefAgent.sh
-r-xrwxr-x 1 colgray eng 132 Nov 1 16:00 RefAgent.sh
ASKER
sorry the suggestion was to:
Assuming you are the coldgray user :
First type : chmod -R u+rw LATEST
and then : rm -rf LATEST
Assuming you are the coldgray user :
First type : chmod -R u+rw LATEST
and then : rm -rf LATEST
Yep, that would do it. I had a feeling something inside the directory was causing it, but couldn't see it until you pasted that output - and yes, OHUPE's suggestion should do what you need.
ASKER
xterm, so what is chmod -R u+rw LATEST really doing, blowing away all the permissions that were previously there?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
rm -rf LATEST
The directory is owned by user colgray. If that is not the user that you are logged in as, then you would need to be either:
1) root
or
2) Logged in as a user in the group "eng" (since the folder is also group writable) You can type "id" to find out what groups you are in.