Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a directory ~/c9/support/npm that is owned by my account. I have a target directory /mnt/ws/users/jan/npm that doesn't exist yet, but /users/jan is owned by usr_jan. Now I want to copy the folder to it's new location and I do:

sudo -Hu usr_jan cp -r ~/c9/support/npm /mnt/ws/users/jan/npm

Now it throws:

cp: cannot access /home/cloud9/c9/support/npm

Is it like prohibited to access data from someone else's home folder, even with sudo?

share|improve this question
up vote 0 down vote accepted

Of course, "sudo -Hu usr_jan" will do everything as that user, with their home directory, and not root. Use "sudo cp -pr /home/cloud9/c9/support/npm /mnt/ws/users/jan/" if you want to keep permissions from the source directory. cp -p keeps ownership/permissions if run by root.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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