0

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?

Dan

4
  • do you have permission for mmh directory ?
    – Miqdad Ali
    Commented Jul 4, 2012 at 10:13
  • No, the mmh directory is set to the default permission.
    – Dan Greaves
    Commented Jul 4, 2012 at 10:15
  • r u super user and do you have permission to access that home directory ?
    – Miqdad Ali
    Commented Jul 4, 2012 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
    Commented Jul 4, 2012 at 10:32

1 Answer 1

0

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.

1
  • 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
    Commented Jul 4, 2012 at 10:35

You must log in to answer this question.