2

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?

2 Answers 2

4

Yes You should use Your home folder

for example

mkdir home/YourUserName/Ruby
2
  • 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, 2012 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, 2012 at 22:14
2

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

See:

https://help.ubuntu.com/community/FilePermissions

https://help.ubuntu.com/community/ApacheMySQLPHP

https://help.ubuntu.com/community/RootSudo

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 )

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .