Learn about Centmin Mod LEMP Stack today
Register Now

Sysadmin Need Permissions for Root Directory

Discussion in 'System Administration' started by ljseals, Jan 18, 2017.

  1. ljseals

    ljseals Member

    101
    24
    18
    Dec 20, 2016
    Ratings:
    +46
    Local Time:
    12:40 AM
    I was not paying attention and was blindly copying and pasting into the ssh terminal and I mistakenly changed the permission on my root folders and files.

    Code:
    [root@srv1 ~]# find . -type f -exec chmod 400 {} \;
    [root@srv1 ~]# find . -type d -exec chmod 500 {} \;
    [root@srv1 ~]# find var/ -type f -exec chmod 600 {} \;
    find: ‘var/’: No such file or directory
    [root@srv1 ~]# find media/ -type f -exec chmod 600 {} \;
    find: ‘media/’: No such file or directory
    

    I only realized it when it stated that there was no such file or directory as my command to cd was not entered on login. It seems it would be a simple fix but I do not know what permissions that the files had before. It seems other folders are set at 755 and files at 644 but I do not want to do anything to mess up at this point. I pray for the Lord's help in this regard. God bless you and thanks in advance.

     
  2. ljseals

    ljseals Member

    101
    24
    18
    Dec 20, 2016
    Ratings:
    +46
    Local Time:
    12:40 AM
    I believe I may have to start over from scratch as I tried to download the files from git but they are not set up as my current system. God bless you!
     
  3. eva2000

    eva2000 Administrator Staff Member

    54,891
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    3:40 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Indeed one of dangers of running at root. Best to do a fresh OS reload from scratch with backed up site data and restore on fresh OS install

    a tip is also cd into directory you want to run commands on and then type = pwd

    present working directory

    it outputs which directory you're current working in

    so get into habit of
    Code (Text):
    cd /directory
    pwd
    
     
  4. ljseals

    ljseals Member

    101
    24
    18
    Dec 20, 2016
    Ratings:
    +46
    Local Time:
    12:40 AM
    Thanks... I run it root the whole time. Is there another way around this. It actually is good that I can practice on restoration. Did I trial run from backup on my website and it took me three minutes. This will take a lot longer but I have been making notes in notepad so it is getting pretty straight forward. God bless you!
     
  5. eva2000

    eva2000 Administrator Staff Member

    54,891
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    3:40 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    practice and getting into good habits so before running any command, type pwd to double check which directory you're working in and if you remove files/directories always cd into directory you are about to remove first
     
  6. RB1

    RB1 Active Member

    292
    75
    28
    Nov 11, 2016
    California
    Ratings:
    +122
    Local Time:
    10:40 PM
    Nginx 1.21.x
    MariaDB 10.1.x
    I run everything as root; Danger is my middle name.
    :LOL:
     
  7. ljseals

    ljseals Member

    101
    24
    18
    Dec 20, 2016
    Ratings:
    +46
    Local Time:
    12:40 AM
    Ha ha ... well it took me about an hour an a half to finish reinstalling. Not so quick...
    Total Install Time (curl yum + cm install + zip download): 2327.0325 seconds
     
  8. RB1

    RB1 Active Member

    292
    75
    28
    Nov 11, 2016
    California
    Ratings:
    +122
    Local Time:
    10:40 PM
    Nginx 1.21.x
    MariaDB 10.1.x
    Yeah CMM and compiling PHP takes forever on my $10 Linode VPS
     
  9. ljseals

    ljseals Member

    101
    24
    18
    Dec 20, 2016
    Ratings:
    +46
    Local Time:
    12:40 AM
    Well....Uptime Robot is not too accurate still showing 100% uptime.
     

    Attached Files: