On 05/29/2011 06:37 PM, Akash Deep Shakya wrote: > sudo chown 755 /var/www > > Regards > Akash Deep Shakya > > > > On Sun, May 29, 2011 at 10:36 PM, Everest K.C. <[email protected] > <mailto:[email protected]>> wrote: > > Hello, > I just installed LAMP server in Ubuntu 11.04 but using my > personal account I was unable to save my script in /var/www folder > but when I unlocked and saved it with the account root it worked. > All I want is to grant permission to my personal account as > well.Can anyone help me please???? > > -Everest K.C. > IOE, Pulchowk Campus > -- > FOSS Nepal mailing list: [email protected] > <mailto:[email protected]> > http://groups.google.com/group/foss-nepal > To unsubscribe, e-mail: [email protected] > <mailto:foss-nepal%[email protected]> > > Mailing List Guidelines: > http://wiki.fossnepal.org/index.php?title=Mailing_List_Guidelines > Community website: http://www.fossnepal.org/ > > > -- > FOSS Nepal mailing list: [email protected] > http://groups.google.com/group/foss-nepal > To unsubscribe, e-mail: [email protected] > > Mailing List Guidelines: > http://wiki.fossnepal.org/index.php?title=Mailing_List_Guidelines > Community website: http://www.fossnepal.org/ Hi Everest KC, You need to understand the file/folder permission in Linux. On a Ubuntu machine, Apache's document root is hosted at /var/www/. So you'll need to put the files/folders that you need to host inside that directory. That directory (if I'm not confused) is owned by the user called "www-data" or "root". So in order to copy files to the directory, you'll need the root users access. You can use "sudo" to copy files/folders inside the directory, e.g.:
sudo cp myfile /var/www/ Again, you'll need to have the read and execute (in case of scripts like PHP, Python) bits set of the file/folder, so you can do: sudo chmod 755 /var/www/myfile Additionally you can set the file/folder to be owed by the "www-data" user and/or group so that apache don't give you any problems while hosting it: sudo chown www-data:www-data /var/www/myfile And you're done. But this will mean that everytime you want to edit the file, you'll need sudo permission. Alternatively, you can allow yourself (the user) to have write permissions over the file. To do so, you can follow these steps: sudo cp myfile /var/www/ sudo chmod 775 /var/www/myfile sudo chown www-data:www-data /var/www/myfile sudo usermod -G www-data <your_user> The second command will set Write permission to the owner and the owner group, the third command will set the www-data user as the owner and www-data as the owner group. The fourth command will add <your_user> to the www-data group. So since <your_user> is in the www-data group, and the members of the owner_group has write permissions, you'll consecutively have write permission over the files. If you want to set permissions over a folder instead, user a "-R" parameter in chown and chmod commands. Hope this helps you. Thank you. -- Abhishek Singh FOSS Nepal Community http://wiki.fossnepal.org
signature.asc
Description: OpenPGP digital signature
