I have a couple of files that I want to move to another's user home directory. I don't have permissions to write to that user's home directory, but I know his password.

I know how to copy the file using scp (see here). However, if I want to move the file, copying and then removing the original file is inefficient. Is there a way to move the file, without using sudo (I don't know the root's password)?

  • 2
    using sudo doesn't require the root p/w, but your own, as long as your user is in the sudoer group.
    – fduff
    Feb 19, 2015 at 19:46
  • 2
    FYI, a move on the same filesystem is not copy then delete. A move just moves. It's only moves across filesystems that are simulated by copying and deleting. Feb 19, 2015 at 23:31

2 Answers 2


Subject to certain assumptions that the target user can actually access the file in its original location, the following approach could work:


su target_user sh -c "ln -f '$SRC' '$DST'" && rm -f "$SRC"

This "moves" the file to the new user's location, but does not change the ownership or permissions.

  • 1
    +1 This does link unlink (an implementation of move), as different users. So no write access of source files is needed by receiving user. Feb 19, 2015 at 23:42
  • I want to move a full directory (along with its contents). I get an error: ln: ‘$SRC’: hard link not allowed for directory
    – a06e
    Jun 2, 2016 at 12:17
  • This answers my original question. I asked about directories here.
    – a06e
    Jun 2, 2016 at 12:20

You can su to any user, if you know there password. (for sudo you need to be a sudoer, and know your own password).

So make the files readable and directory writeable(for deletion) by the other user, add files to a shared group, or use access-control-lists (ACLs) setfacl (What are the different ways to set file permissions etc on gnu/linux)

Then su other user Then do the move.

Also look at @roaima 's answer for how to do it without giving write access away to receiving user.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .