PDA

View Full Version : [ubuntu] Permission problem with waste bin



dan1973
April 21st, 2009, 07:10 PM
Hello, I'm trying to get rid of a file in the recycle bin but it won't let me. Permission denied.

When I look at the permissions of the file in question, it won't let me change them.

how do i force a delete from the bin of the offending file?

Many thanks,:(

kyleflan
April 21st, 2009, 07:16 PM
You probably need to change the owner or permissions. Can you run "ls -l" on the directory in question?

amingv
April 21st, 2009, 07:16 PM
try


sudo rm /home/user/.local/share/Trash/files/<nameoffile>

kyleflan
April 21st, 2009, 07:17 PM
Also, running the command below may solve your problem:


sudo rm filename

Which runs the rm as root.

bumanie
April 21st, 2009, 07:18 PM
Type
gksudo nautilus in terminal, put in password and then go to Places --> Computer --> Filesystem and navigate to the waste bin and you should be able to delete the file/s. gksudo is super user in graphical mode, so be careful what you remove.

dan1973
April 21st, 2009, 07:52 PM
Still no luck,

gksudo nautilus gives the following:


dan@ubuntu:/home$ gksudo nautilus
seahorse nautilus module initializedInitializing nautilus-share extension
Nautilus-Share-Message: Called "net usershare info" but it failed: 'net usershare' returned error 255: net usershare: cannot open usershare directory /var/lib/samba/usershares. Error No such file or directory
Please ask your system administrator to enable user sharing.


** (nautilus:12306): WARNING **: Unable to add monitor: Operation not supported

** (nautilus:12306): WARNING **: Unable to add monitor: Operation not supported

It does then open root file browser, but where is the trash bin to be found in file browser?

amingv
April 21st, 2009, 07:57 PM
Still no luck,

gksudo nautilus gives the following:


dan@ubuntu:/home$ gksudo nautilus
seahorse nautilus module initializedInitializing nautilus-share extension
Nautilus-Share-Message: Called "net usershare info" but it failed: 'net usershare' returned error 255: net usershare: cannot open usershare directory /var/lib/samba/usershares. Error No such file or directory
Please ask your system administrator to enable user sharing.


** (nautilus:12306): WARNING **: Unable to add monitor: Operation not supported

** (nautilus:12306): WARNING **: Unable to add monitor: Operation not supported

It does then open root file browser, but where is the trash bin to be found in file browser?

See my post. I gave you the whole path.

dan1973
April 21st, 2009, 08:16 PM
Ok, so i run following:


dan@ubuntu:~$ sudo rm /home/user/.local/share/Trash/files/ndiswrapper-1.54

result:


rm: cannot remove `/home/user/.local/share/Trash/files/ndiswrapper-1.54': No such file or directory



Problem is that it still shows up in the trash bin,

Strange...

What am i missing?

amingv
April 21st, 2009, 08:23 PM
Ok, so i run following:


dan@ubuntu:~$ sudo rm /home/user/.local/share/Trash/files/ndiswrapper-1.54

result:


rm: cannot remove `/home/user/.local/share/Trash/files/ndiswrapper-1.54': No such file or directory



Problem is that it still shows up in the trash bin,

Strange...

What am i missing?

Replace "user" in the command by your actual username.

sisco311
April 21st, 2009, 08:24 PM
sudo chown -R $USER\: ~/.local/share/Trash/files
then try to empty the Trash.

Michael.Godawski
April 21st, 2009, 08:29 PM
You can use this command to delete the trash contents of your home folder:

rm -rf ~/.local/share/Trash/*
If you get permission problems try to slip a sudo in front of the commands, but be sure that the path is correct.
Sometimes it is necessary to change the ownership of the thrash files:

sudo chown -R yourusername /home/yourusername/.local/share/Trash

kiridude
April 21st, 2009, 08:30 PM
Use nautilus as told by Bumanie, then follow the path as indicated by Amingv - but type ctrl h once inside nautilus otherwise you will not be able to see .local in /home/yourusername. Your trash is there and you can delete whatever you want this way.

sisco311
April 21st, 2009, 08:35 PM
You can open nautilus directly in the trash directory:

gksu nautilus ~/.local/share/Trash/files

dan1973
April 21st, 2009, 08:45 PM
OK, i think i'm getting somewhere......



rm: cannot remove `ndiswrapper-1.54/': Is a directory
root@ubuntu:/home/dan/.local/share/Trash/files# rmdir ndiswrapper-1.54/
rmdir: failed to remove `ndiswrapper-1.54/': Directory not empty
root@ubuntu:/home/dan/.local/share/Trash/files#


Just need to be able to delete a full directory...

Michael.Godawski
April 21st, 2009, 08:51 PM
See my first post, the -r suffix in the code means recursive and it removes directories and their contents recursively.

Be cautious with this. Do not delete your whole system ;).
Make sure the path after the rm command is correct.

I remember days when I destroyed my whole system playing around with the rm command... long time ago.

You can always check what a command does and the additional option it has with:


man commandname

man rm

sisco311
April 21st, 2009, 08:52 PM
OK, i think i'm getting somewhere......



rm: cannot remove `ndiswrapper-1.54/': Is a directory
root@ubuntu:/home/dan/.local/share/Trash/files# rmdir ndiswrapper-1.54/
rmdir: failed to remove `ndiswrapper-1.54/': Directory not empty
root@ubuntu:/home/dan/.local/share/Trash/files#


Just need to be able to delete a full directory...

Did you try the other suggestions?

In my opinion the safest is to change the owner(chown) of the Trash
and delete the content as a regular user.

When you delete directories with the rm command, you have to use the -r flag:

rm -r /path/to/dir

dan1973
April 21st, 2009, 08:53 PM
Thanks Michael.godawski, popped a sudo in front of your command and finally if went away!

Michael.Godawski
April 21st, 2009, 08:54 PM
Good to hear. I hope only the file and directory which should be deleted are now gone ;).
The rm command and sudo are dangerous friends.

dan1973
April 21st, 2009, 08:56 PM
Thanks for the ctrl h option - nice to see where things are!

Even so didn't manage to delete from there - permission problem, i don't think i was as 'super user'

Problem taken care of now

thanks again

dan1973
April 21st, 2009, 08:58 PM
But what great teamwork!!!!

LiamWilson
April 21st, 2009, 08:59 PM
I always have to use sudo rm -rf to delete files from the trash i 'dont have permission' to delete. Should we do something about it?

dan1973
April 21st, 2009, 09:00 PM
Did you try the other suggestions?

In my opinion the safest is to change the owner(chown) of the Trash
and delete the content as a regular user.

When you delete directories with the rm command, you have to use the -r flag:

rm -r /path/to/dir

Should have done it this way ! Definitely next time if problem raises its ugly head again.

Many thanks for the sage advice.

kiridude
April 21st, 2009, 09:24 PM
Thanks for the ctrl h option - nice to see where things are!

Even so didn't manage to delete from there - permission problem, i don't think i was as 'super user'

you must put gksudo in front of "nautilus" command to enter as super-user.

Anyway, glad to see you got it taken care of.