when I try and drop a file into my apache folder it wont let me when I try and access my source server it wont let me, error do not have permissions :(

Any Ideas?

I tried loging in as root but it wont lket me at the login screen and when I type in terminal su and put my pass it it is like # and what do i do from there :S

Cheers
Bondi

Dani AI

Generated

Quick diagnosis: the symptom normally means the Apache document root is owned or writable only by another account. Check ownership and mode first so you know what to change:

ls -ld /var/www /var/www/html
ls -l /var/www/html

Comment on earlier advice: 's approach (change owner recursively) will work for a single-user dev box, but it can be unsafe on shared or production machines. A safer pattern is group-based access so the webserver user keeps responsibility for serving files while your user gets write rights.

Practical, safer steps (replace yourusername with your login):

sudo usermod -aG www-data yourusername
# re-login or run:
newgrp www-data

sudo chgrp -R www-data /var/www
sudo chmod -R g+rwX /var/www

What you did with su: seeing a # prompt means you are root and can run commands; type exit to return to your normal shell. Prefer sudo or sudoedit for individual commands or edits instead of running a long-lived root GUI session.

Extra tips: give directories execute bit for traversal and files non-executable where appropriate:

sudo find /var/www -type d -exec chmod 755 {} \;
sudo find /var/www -type f -exec chmod 644 {} \;

Avoid chmod 777. If you need automatic group inheritance for new files, consider ACLs (setfacl) so new files keep the www-data group with the correct permissions.

Recommended Answers

All 2 Replies

Try this in Konsole (Terminal):

chown -hR username foldername

I have this settings on /var/www folder, bacause there is Apache localhost for files. This makes you as owner for folder and all subfolders, Be careful, where this be set.

;)

Thank You

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.