I just installed Ubuntu on my personal machine. I've never used Linux before. I installed Ruby, and Ruby on Rails. I'm about to start a new project. Where should I save it?

I tried cd /var then mkdir www and got a permission denied error. So I did sudo mkdir www. But now I am afraid that every time I want to save or create something, whether using Rails console or my text editor, I'm going to get permission errors.

Should I move my project into my home dir?


Yes You should use Your home folder

for example

mkdir home/YourUserName/Ruby
| improve this answer | |
  • Thanks! But what if I decide to install Apache and start developing in say, PHP. Should my files be in /var/www/ then? – Mohamad Jan 26 '12 at 21:59
  • Why so? I keep all my work in my home folder. If You want to be an admin, or have a permission to write files in some other place You need to configure users and groups and what they can do with those files. – Misery Jan 26 '12 at 22:14

Add your user to the www-data group.

Then log out and back in.

The set your permissions in /var/www

Files are owned by root:www-data , permissions of 660

Directories are also owned by root:www-data , permissions of 770





On a production server (anything publilc facing), I use the same ownership. Permissions - files 640 directories 750

On a production server I edit everything as root ( sudo -e /var/www/file )

| improve this answer | |

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.