amazon web services - Setting permissions to WordPress to install plugins is preventing access through SSH -


i have read several ways solve problem of permissions in wordpress install themes , plugins wordpress administration.

as understand problem owner of folder wordpress installed must user manages web server (read postdata). in case apache , aws, www-data.

however, changing owner www-data (even changing group user), lose ssh access server. in case had ask administrator of entire server access user , restore owner , permissions of folder.

i using amazon web services ubuntu 16.0.4 lts have access main user , installation of wordpress located @ root of user, i.e. /home/myuser/

i accessing via ssh .pem key , myuser@publicdns

what can do?

thank much.

pd: wordpress in this guide says owner has ftp web server owner (i.e. myuser) , never webserver, agree.

i hate having answer own question maybe can others solve problems , fast. worked me:

before doing of should take note of permissions, owners , groups of folders & files changing here because website may fail after changing these settings. hosts have different configurations.

as long don't exit session, may able return changes have made sudo privileges.


if wordpress installation in root folder of user, eg: /home/myuser/

take note of permissions, owners , groups:

with ls command , -a -l flags can see files using long listing format. being in /home , /home/youruser/ paths.

cd /home     ls -al cd /home/youruser ls -al 

copy output , save in text file.

prevent losing ssh access:

the owner of folder must user accessing with.

sudo chown youruser /home/youruser/ 

i have set group of folder myuser.

sudo chgrp youruser /home/youruser/ 

set permissions of folder 751 (i think important thing here owner has full access)

sudo chmod 751 /home/youruser/ 

the permissions hidden folder .ssh must 700 top folder, 600 files inside folder , owner & group must youruser

sudo chmod 700 ~/.ssh/ sudo chmod 600 ~/.ssh/* sudo chown -r youruser ~/.ssh/ sudo chgrp -r youruser ~/.ssh/ 

solve plugins & theme installation problems:

i'm still unsure if solution right site security. however, think can apply fix , return changes. website should run smoothly in both cases.

i have changed permissions folders , files via sftp in nautilus. if using .pem key remember add key using ssh-add path/to/your/key.pem connect server sftp://youruser@yourpublicdns

make multiple click in folders wp-content, wp-admin, wp-includes , right click -> properties (or ctrl + i), change permission tab , click in "apply permissions enclosed files" button on bottom of window, set:

files

  • owner: read , write
  • group: read only
  • others: read only

folders

  • owner: create , delete files.
  • access files.
  • access files.

this apply changes files , folders inside these 3 folders selected. depending on speed of internet , how files have, may take minutes finish.

make multiple click in remaining files , right click -> properties (or ctrl + i), change permission tab , set

  • owner: read , write
  • group: read , write
  • others: read

and last

change owner , group of wordpress installation files, i.e. files inside /home/youruser

sudo chown -r www-data wp* sudo chgrp -r www-data wp* 

this make changes files start "wp" word recursively. remaining files, have made changes manually. there better ways find command changed hidden folders decided manually.

apply corresponding changes files .htaccess well.

note: test website. access it, access wordpress admin, try installing plugins , themes, open terminal (don't close 1 writing commands) , try ssh webserver. if have problems use backup , revert process.

hope helps.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -