Learn about Centmin Mod LEMP Stack today
Register Now

cannot create directory `/root'

Discussion in 'Bug Reports' started by GASTAN, Jul 23, 2018.

  1. GASTAN

    GASTAN Member

    103
    12
    18
    Jun 28, 2017
    Ratings:
    +18
    Local Time:
    4:34 AM
    I updated centmin on weekend and I am getting followir errors when loggin in to server:

    mkdir: cannot create directory `/root': Permission denied

    where did that came from ?


    Please fill in any relevant information that applies to you:
    • CentOS Version: i.e. CentOS 6 32bit or 64bit / CentOS 7 64bit ?
    • Centmin Mod Version Installed: i.e. 123.08stable or 123.09beta01
    • Nginx Version Installed: i.e. 1.11.10
    • PHP Version Installed: i.e. 5.6.30 or 7.0.15
    • MariaDB MySQL Version Installed: i.e. 10.0.21 or 10.1.21
    • When was last time updated Centmin Mod code base ? : i.e. run centmin.sh menu option 23 submenu option 2
    • Persistent Config: Do you have any persistent config file options set in /etc/centminmod/custom_config.inc ? You can check via this command:


      cat /etc/centminmod/custom_config.inc


      Post output in CODE tags.
     
  2. eva2000

    eva2000 Administrator Staff Member

    53,507
    12,132
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,675
    Local Time:
    12:34 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    are you logging in as root user or a non-root user ?
     
  3. GASTAN

    GASTAN Member

    103
    12
    18
    Jun 28, 2017
    Ratings:
    +18
    Local Time:
    4:34 AM
    non-root
     
  4. GASTAN

    GASTAN Member

    103
    12
    18
    Jun 28, 2017
    Ratings:
    +18
    Local Time:
    4:34 AM
    I updated centmin today, but prob still persist

    Code:
    login as: nonrootuser
    Authenticating with public key "rsa-key-xxxxxx06"
    Last login: Mon Jul 23 13:22:26 2018 from <myip>
    mkdir: cannot create directory `/root': Permission denied
    [nonrootuser@machine01 ~]$
    
     
  5. eva2000

    eva2000 Administrator Staff Member

    53,507
    12,132
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,675
    Local Time:
    12:34 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    that's the problem, centmin routines usually expect root user for centmin.sh usage especially - you're running into centmin mod checking if centmin log directory exists at /root/centminlogs - all centmin.sh menu option's actions are logged to that directory. So on SSH login centmin mod checks to see if /root/centminlogs exists and if not create it but need root user to create.

    I added fix to 123.09beta01 to only try creating that log directory if root user is detected on SSH login.

    As root user, you should create the directory manually though
    Code (Text):
    mkdir -p /root/centminlogs
    
     
  6. GASTAN

    GASTAN Member

    103
    12
    18
    Jun 28, 2017
    Ratings:
    +18
    Local Time:
    4:34 AM
    I log in as nonroot and then do sudo su -
    I assumed it's safer to not to let root to log in.
    the thing is /root/centminlogs folder exists for some time now (from installation, updates, vhosting adds)

    btw: what's the scoop with I have to change dir whne reruing centmin after udpate?
     
  7. eva2000

    eva2000 Administrator Staff Member

    53,507
    12,132
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,675
    Local Time:
    12:34 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yeah that's because non-root user can't see /root/centminlogs.. i fixed it in 123.09beta01 update which you can update in 123.09beta01 via = cmupdate command

    updating centmin mod code only updates the code, it doesn't run any routines that are required to update existing server environment until centmin.sh is run once