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)?


You can:

  1. Make your home directory world-readable and writeable.
  2. Login into his account.
  3. Move your files to his directory.
  4. Change ownership of said files.
  5. Logout of his account.
  6. Revert permissions of your home directory.

Detailed Step-by-Step Guide

Assume you're becko and you want to move the files to bob's home directory. Thus the paths for your homes are as follows (by default):

becko: /home/becko/
bob: /home/bob/

Now let's say the paths of the files you want to move are as follows:


Now, with this introduction, we can start.

NOTE: This example assumes all relevant files are one level below your home directory.

Step One: Make your home directory world-readable and writeable

While logged in as yourself, open a terminal (Ctrl+Alt+T).

Go to your home directory and make it world-readable:

$ cd ~
$ chmod 0777 .

Step Two: Login into his Account

Then, using the example provided above:

$ su - bob

You'll be prompted with his password.

Step Three: Move your files to his directory

After you login, you should see the following prompt (or something close to it):


Now you are in bob's home directory. Now, time to move your stuff over.

The following commands should do it:

$ mv /home/becko/file_01 .
$ mv /home/becko/file_02 .
$ mv /home/becko/file_03 .

Step Four: Change Ownership of Files:

NOTE: For me, the ownership changed to bob automatically, but might as well be safe than sorry. :)


$ chown bob:bob file_01
$ chown bob:bob file_02
$ chown bob:bob file_03

Step Five: Logout of His Account

This one's easy. Type:

$ logout

Your prompt should then change back to something like:


Step Six: Revert your home directory permissions.

By default, the permissions are 0755. So, we'll do that:

$ chmod 0755 .

Close the terminal and you're done!

  • 2
    Just a tip here, since you may not know this and it's pretty useful... there is no reason to use cd ~, because cd by itself does the same thing. – Marty Fried Feb 19 '15 at 19:41
  • I actually didn't know that! Thank you! :) We all learn something new every day. – user376787 Feb 19 '15 at 19:44
  • 2
    We do, if we pay attention. I've been using the bash shell for many years, even when I used Windows (Cygwin), and knowing these little tricks makes it much easier. There are many of them available. :-) – Marty Fried Feb 19 '15 at 20:08

You don't need the root's password for sudo, you need your password; in fact, there is no root password in a normal Ubuntu installation.

But, if you can't, or don't want to use sudo, you could make sure the file and it's directory have read/write (modify) permissions for everyone, then log in as the other person, and move it normally. Or, make a directory in the other person's home directory, and set it to writable so you can move things there as yourself.

This is basic linux behavior.


Actually we may need some more information. For example, you don't need to know the root password to use sudo. If your user is in sudo group you can use sudo with your user's regular password. So, If this is the case:

sudo mv file_to_move /home/desired_user

If you can't use sudo you can write a simple bash script to copy the file with scp and after that delete it. But, if you have rsync installed:

rsync -avz --remove-source-files -e ssh file_to_move desired_user@

works also.

  • I'm not sudoer. Also, I know that scp followed by rm would work, but that's inefficient for large files. A mv would just take seconds, since the files are in the same filesystem! – becko Feb 19 '15 at 21:13
  • If so, you can't move files without root privileges or sudo. Maybe with some group settings or ACL Mumbo jumbo, but it is Mumbo jumbo. Also, if you don't have root privileges this is not possible for you. Have you tried rsync? – heartsmagic Feb 19 '15 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.