How to access /var/www/html folder from ubuntu user through SFTP

I messed up with some permission level on /var/www/ and /var/www/html/folders by running some random commands through putty.

Initially I want to add or edit some files in /var/www/html/ and I executed some commands which give me the permission to add or edit files through SFTP. But it causes a problem and I was unable to update or create any files through webserver apache.

After then I executed some random commands which gives apache to view and edit files under /var/www/html/ but I m not not able to view files from SFTP.

I have attached some screenshot of folder permission

My Configurtion

OS: Ubuntu 18.04
Provider: AWS
FTP Username: ubuntu

I logged in to SFTP through PPK files

Now I want to gain access through SFTP to /var/www/html/

enter image description here

enter image description here

2 Answers

You need to log in as a user with sudo permission, or as root. If the user does not have root permission, they have to respect the folder owner

And since the owner is apache, of course certain non sudo users can't access it

3

I manage with similar case in that way:

groupadd web
groupmems -g web -a myuser
chown -R .web /var/www/html/
chmod -R g+w /var/www/html/
mkdir ~myuser/web
mount --bind /var/www/html/ ~myuser/web

Explanation: create group for myuser (and others) and mount point in his mode directory. Then mount --bind apache dir.

You have to add mount to the start script.

Now you will have access to apache dir from your home.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like