Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Sorry if I'm posting this at the wrong StackExchange site, but I thought this would fit better here rather than serverfault. Anyway...

I'm writing a bash script that creates folders and writes to new files within that folder. The owner of the folder in which I'm creating my folder is owned by root, and I don't want to change that. I do want to own the folder that I'm creating and any files within it, however.

So I create the folder, and naturally I then have to chown the folder to me. I also give everyone users rwx access to the folder using chmod. The problem arises when I try to use the > operator to send a mysqldump to a file in that folder. I always get 'permission denied' errors, I assume because I don't have file access to that folder. Sure enough, when I navigate to that folder in Nautilus, Folder access is set to 'Create and delete files', but File access is set to '---'.

Long story short, how would I go about setting that File access through a bash command? And if you suspect that this is not the problem, what is, and how do I solve it?

Thank you in advance!

share|improve this question
umask? Or you could try to touch, chmod, then write to the file? – Daniel Beck Nov 9 '10 at 20:17
I can't see any mistake in your description of what you're doing, but it's very imprecise. You should post the exact (copy-paste) sequence of commands you're running and error messages you're getting. Make sure to be clear what user is running each command. Also post the output of ls -ld for the directories and files involved in the proces. – Gilles Nov 9 '10 at 20:21
Sorry for the imprecision. I would update it with my code, but touch, chmod, write seems like an excellent solution. I'm going to try it out now. – Mrrvomun Nov 10 '10 at 19:40
Yep, it worked! Thanks so much! If you want to put it down as an answer, I can accept it. – Mrrvomun Nov 12 '10 at 19:21

Your Answer


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

Browse other questions tagged or ask your own question.