Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't trash regular file #9

Closed
alqh opened this issue Oct 9, 2012 · 7 comments
Closed

Can't trash regular file #9

alqh opened this issue Oct 9, 2012 · 7 comments

Comments

@alqh
Copy link

alqh commented Oct 9, 2012

Hi,

I'm trying to trash a file stored in the mounted drive /media/NameOfMyDrive.

eg.

$ touch something
$ trash-put something
trash-put: cannot trash regular file `something'

It works on home directory, but doesn't on a mounted drive.
Drive is exFat, and a .Trash- is present in the drive.
Maybe it has something to do with the permission of /media, although to create, delete file from mount doesn't require the admin permission

@andreafrancia
Copy link
Owner

The .Trash-$uid and the .Trash directories should be created in the volume, usually this means /media/disk/.Trash or /media/disk/.Trash-123. Moreover the /media/disk/.Trash directory needs the sticky bit set.

@drevicko
Copy link

drevicko commented May 9, 2013

@andreafrancia do you know off hand the commands necessary to set the sticky bit?
What if I wish to have write permission only to part of a disks file heirarchy - is it possible to have .Trash folders in other locations? There'd be all sorts of issues about where to look for it etc... (eg: if things are trashed by different users etc..), but it should be possible to work out a sensible strategy I think.
I currently have 'rm' aliased to 'trash-put' - in the situation above, I'm stuck it seems, and have to use /bin/rm ... to delete things.

@andreafrancia
Copy link
Owner

As drevicko said:

@andreafrancia do you know off hand
the commands necessary to set the sticky bit?

chmod +t FILE

What if I wish to have write permission only to part of a disks file
heirarchy

man chmod
man chown
Google about "unix group and user permissions".

  • is it possible to have .Trash folders in other locations?

TrashSpecs mandates that the location should be $topdir/.Trash

There'd be all sorts of issues about where to look for it etc... (eg: if
things are trashed by different users etc..), but it should be possible to
work out a sensible strategy I think.

Check out the FreeDesktop.org TrashSpec.

I currently have 'rm' aliased to 'trash-put' - in the situation above,

Don't do this. It's a bad idea. If I suggested somewhere to do this I was
wrong.

I'm stuck it seems, and have to use /bin/rm ... to delete things.

You can bypass aliases adding a leading backslash:

\rm FILE

@drevicko
Copy link

Excellent response! Thankyou @andreafrancia for taking the time and providing all that useful info (:

Having a quick look at the TrashSpec, I'd say that making $topdir/.Trash globally writable probably isn't such an issue - stuff retains its permissions when put there.

You're probably right about aliasing rm - better to use trash-put or a simplifying alias like trash. I have an engrained habit of using rm though, and have been bitten by it a few times, so for now I'll keep it aliased to trash-put and try to change my habit ;)

@andreafrancia
Copy link
Owner

You may want create an alias like this:

alias rm='echo "This is not the command you are looking for."; false'

@drevicko
Copy link

I like your style ;)

@bnaman50
Copy link

Hey @andreafrancia , I am facing the similar issue.

When I use trash-put in my home directory, it works perfectly as you can see
image

However, we have another disk \data and trash-put command does not work there.
image

I have created a .Trash-$UID dir and provided the permissions as mentioned in the documentation
chmod a+rw .Trash-$UID` chmod +t .Trash-$UID

I am not sure what to do. Could you please help me out?

Thanks,
Naman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants