I mistakenly ran chmod -R a+rw web1/ on that web1 folder, meant to unprotect it momentarily to add some files in web1/ How can I undo that command, as everything seems writable now, all directories are highlighted green.
Here is how the permissions of a website are set: Code: root@server1:/var/www/test.tld# ls -la total 36 drwxr-xr-x 9 root root 4096 Feb 27 2018 . drwxr-xr-x 4 root root 4096 Oct 18 15:50 .. drwxr-xr-x 2 web1 client0 4096 Feb 27 2018 cgi-bin drwxr-xr-x 2 root root 4096 Oct 24 11:46 log drwx--x--- 2 web1 client0 4096 Oct 7 13:00 private drwx------ 2 web1 client0 4096 Feb 27 2018 .ssh drwxr-xr-x 2 root root 4096 Feb 27 2018 ssl drwxrwxrwx 2 web1 client0 4096 Aug 15 01:19 tmp drwxr-x--x 14 web1 client0 4096 Feb 27 2018 web
This is our web1 drwxr-xr-x 12 root root 4.0K Oct 25 00:48 web1 if I ran chmod -R o+rw web1/ would it undo the chmod -R a+rw web1/ ????
No it won't. It wouldn't have any effect because "other" already has rw rights. You can use chmod -R o-rw to remove the rw rights for the user "other" (so not part of web1 user or client1 group). This won't restore the previous setting of the chmod of directories and files inside the web1 folder, but simply remove all rw access for "other". If files or dirs had rwxrwxrwx (777) before you executed your a+rw command, this will also have 774 if you remove the rw.
Not the best idea as every user has full access to all files and dirs in that web now by using e. g. perl scripts or php shell functions etc. in his own web.
Now when we connect to our FTP, nothing is shown (no directories or files), just blank. Would anything we did here have anything to do with it???
Looking at what till posted above with what the permissions should look like, I see ours do not match that. Code: root@dor1:/var/www/clients/client1/web1# ls -lh total 56K -rw-r----- 1 web1 client1 487 Oct 25 00:21 amazon_ses.php drwxrwx--x 2 web1 client1 4.0K Sep 9 2015 cgi-bin -rw-r----- 1 web1 client1 691 Oct 25 00:21 db.php -rw-r----- 1 web1 client1 451 Oct 25 00:21 email_send_config.php drwxrwx--- 3 web1 client1 4.0K Sep 17 2016 home drwxrwxr-x 2 root root 4.0K Oct 25 17:01 log drwxrwx--- 2 web1 client1 4.0K Sep 9 2015 private -rw-r----- 1 web1 client1 1.3K Oct 25 01:17 @server_define.php drwxrwx--x 2 root root 4.0K Aug 5 16:59 ssl drwxrwx--x 3 root root 4.0K Sep 20 10:34 subdomains drwxrwx--- 2 web1 client1 4.0K Oct 25 19:44 tmp -rw-r----- 1 web1 client1 358 Oct 25 00:21 @version_number.php drwxrwx--x 28 web1 client1 4.0K Oct 24 23:08 web drwxrwx--- 2 web1 client1 4.0K Sep 9 2015 webdav
Do you now have backups so you can restore the files if another mistake happens? If you have in addition to chmod run chown, use now chown to correct the file and directory owner and group owner.