Super User is a question and answer site for computer enthusiasts and power users. 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

Good morning,

I am attempting to setup a cron job on my CentOS machine that will transfer a file from one users home directory to a directory in anothers.

btiseis@mymachine [~]# mv ./myfile.csv /home/mmh/tmp

I have ensured that the tmp directory has 0777 permissions but I still get the following error message:

mv: accessing '/home/mmh/tmp': Permission denied

I assume this problem is due to transferring the file across home directories.

Any ideas?


share|improve this question

migrated from Jul 4 '12 at 22:34

This question came from our site for professional and enthusiast programmers.

do you have permission for mmh directory ? – Miqdad Ali Jul 4 '12 at 10:13
No, the mmh directory is set to the default permission. – Dan Greaves Jul 4 '12 at 10:15
r u super user and do you have permission to access that home directory ? – Miqdad Ali Jul 4 '12 at 10:18
No, I am logged in as a normal user (btiseis) although I do have root access. I do not want to use root via cron. – Dan Greaves Jul 4 '12 at 10:32

Home directories are nothing special; it's just users that name them like this. Nothing in a system cares whether a directory is considered a "home directory" for a user.

You DO need permissions on all directories. Thus, you need write permission on /home/mmh/tmp, and read+execute on /home/mmh (although either read or execute are sufficient, just not sure which one. But usually read and execute are either both set or unset for directories) so you can actually get to the /home/mmh/tmp within.

You could get around all this if you run the cronjob as root; it's not generally a good idea to widen access permissions unless you absolutely have to. It may or may not be a problem in your case (I'm guessing there aren't any other users), but bad habits are hard to kill off later.

EDIT: if the two users are "friendly" (like two incarnations of yourself, so you really don't mind the other guy snooping around your data) you could add the main group of the "target" user to the group list of the "sending" user, and use group permissions. On many systems, every user is created with his own private group.

share|improve this answer
If I need to use /home/mmh/public_html/platforms/countryside/tmp as the target directory, would I have to make every directory beneath the tmp directory readable and executable by all? – Dan Greaves Jul 4 '12 at 10:35

You must log in to answer this question.