Learn about Centmin Mod LEMP Stack today
Become a Member

Install dmotd Permission denied - sudo users

Discussion in 'Install & Upgrades or Pre-Install Questions' started by hugup2, Oct 20, 2016.

  1. hugup2

    hugup2 New Member

    13
    2
    3
    Oct 20, 2016
    Ratings:
    +2
    Local Time:
    2:15 PM
    1.11.5
    hi
    I`m using Centos7, nginx 1.11.5 ,php 7.0.10 and centmin 123.09beta01
    my blog working well. but log in shell i receive message
    "-bash: /usr/local/bin/dmotd: Permission denied"
    and doesn`t work centminmod
    "-bash: ./centmin.sh: Permission denied"
    what`s wrong? help me

     
  2. eva2000

    eva2000 Administrator Staff Member

    53,190
    12,113
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,649
    Local Time:
    3:15 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    are you logging in as root user or a sudo user account ?

    what is output for these commands

    Code (Text):
    ls -lah /usr/local/bin/dmotd
    id


    You need to log in as root user
     
  3. hugup2

    hugup2 New Member

    13
    2
    3
    Oct 20, 2016
    Ratings:
    +2
    Local Time:
    2:15 PM
    1.11.5
    [root@mydomain centminmod]# ls -lah /usr/local/bin/dmotd
    lrwxrwxrwx 1 root root 46 Oct 16 11:08 /usr/local/bin/dmotd -> /usr/local/src/centminmod/config/motd/dmotd.sh
    [root@mydomain centminmod]# id
    uid=0(root) gid=0(root) groups=0(root)

    i login sudo user account but change root user using su -
     
  4. eva2000

    eva2000 Administrator Staff Member

    53,190
    12,113
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,649
    Local Time:
    3:15 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    guess that's where the problem is.. centmin mod assumes root user login

    so will have to come up with fix for it in 123.09beta01

    however, sudo to root user should be able to run centmin.sh

    how did you setup the sudo user ? list the steps
     
  5. hugup2

    hugup2 New Member

    13
    2
    3
    Oct 20, 2016
    Ratings:
    +2
    Local Time:
    2:15 PM
    1.11.5
    ok my step

    root login
    useradd
    vi /etc/ssh/sshd_config - PermitRootLogin no
    service sshd restart
    sudo user login
    su - (cahang root user)
    yum -y update; curl -O https://centminmod.com/installer.sh && chmod 0700 installer.sh && bash installer.sh
    cd /usr/local/src/centminmod
    ./centmin.sh
    22 (domain + wordpress + supercache)
    wordpress , supercache setting
    mysql setting
    centminmod update (./centmin.sh -23)
    php update (./centmin.sh -5)
    install varnish
    setting pagespeed
     
  6. eva2000

    eva2000 Administrator Staff Member

    53,190
    12,113
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,649
    Local Time:
    3:15 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    and all those steps worked or the first run centmin.sh is where the problem is ?
     
  7. hugup2

    hugup2 New Member

    13
    2
    3
    Oct 20, 2016
    Ratings:
    +2
    Local Time:
    2:15 PM
    1.11.5
    all step worked fine. blog worked succesful
    but next day i loged in shell
    i saw that message and countinue
     
  8. eva2000

    eva2000 Administrator Staff Member

    53,190
    12,113
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,649
    Local Time:
    3:15 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    strange with 123.09beta01 it at least supports sudo after install unlike 123.08stable which doesn't support sudo

    but you should be able to sudo root user fine, i just tested it without problems

    i tested login as sudo user = motd shows up fine

    i tested sudo su and switch to root user fine

    Code (Text):
    sudo su

    as does
    Code (Text):
    su
     
    Last edited: Oct 20, 2016
  9. eva2000

    eva2000 Administrator Staff Member

    53,190
    12,113
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,649
    Local Time:
    3:15 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    probably need to double check if you setup sudo user properly

    fyi, 123.09beta01 has a tools/addsudousers.sh script which can add and setup sudo users too ;)

    Code (Text):
    tools/addsudousers.sh desiredusername
     
    Last edited: Oct 21, 2016
  10. hugup2

    hugup2 New Member

    13
    2
    3
    Oct 20, 2016
    Ratings:
    +2
    Local Time:
    2:15 PM
    1.11.5
    thanks i reinstall and works fine now
     
  11. eva2000

    eva2000 Administrator Staff Member

    53,190
    12,113
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,649
    Local Time:
    3:15 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Great to hear :)
     
  12. hugup2

    hugup2 New Member

    13
    2
    3
    Oct 20, 2016
    Ratings:
    +2
    Local Time:
    2:15 PM
    1.11.5
    sadly it again came out -bash: /usr/local/bin/dmotd: Permission denied.

    does this command affect?

    chown -R nginx:ftpusername /home/nginx

    chmod -R 770 /home/nginx

    find ./ -type f -exec chmod -v 660 {} \;

    chmod -R 644 /home/nginx/domains/mydomain.com/public/.htaccess
     
  13. eva2000

    eva2000 Administrator Staff Member

    53,190
    12,113
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,649
    Local Time:
    3:15 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    that will mess up file permssions for nginx served sites !

    file is owned by root so with proper sudo user it should work

    if you log in as root user does it have same issue ? if not then it's your sudo user setup issue. I've tested with sudo user and no problems with dmotd permissions
     
    Last edited: Oct 30, 2016
  14. eva2000

    eva2000 Administrator Staff Member

    53,190
    12,113
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,649
    Local Time:
    3:15 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    .htaccess isn't supported in nginx so no usage using .htaccess
     
  15. eva2000

    eva2000 Administrator Staff Member

    53,190
    12,113
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,649
    Local Time:
    3:15 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    this will mess with permissions too
     
  16. eva2000

    eva2000 Administrator Staff Member

    53,190
    12,113
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,649
    Local Time:
    3:15 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    To fix nginx incorrect permissions you did use ssh commands
    Code (Text):
    chown -R nginx:nginx /home/nginx
    chmod g+s /home/nginx
    chmod g+s /home/nginx/domains/
    
     
  17. eva2000

    eva2000 Administrator Staff Member

    53,190
    12,113
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,649
    Local Time:
    3:15 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    fyi, 123.09beta01 has a tools/addsudousers.sh script which can add and setup sudo users too ;)

    Code (Text):
    tools/addsudousers.sh desiredusername


    so maybe as root user, setup a 2nd sudo user via tools/addsuousers.sh and see if logging in with this sudo user works
     
  18. hugup2

    hugup2 New Member

    13
    2
    3
    Oct 20, 2016
    Ratings:
    +2
    Local Time:
    2:15 PM
    1.11.5
    ok. but I ca`t connect sftp from filezilla
    using ftpusername.
     
  19. eva2000

    eva2000 Administrator Staff Member

    53,190
    12,113
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,649
    Local Time:
    3:15 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Use the pure-ftpd virtual ftp user generated with your account Pure-FTPD Virtual FTP Users - CentminMod.com LEMP Nginx web stack for CentOS
    • Did you let the script generate a password for you or set your own ?
    • Did you make sure to enable explicit TLS/SSL mode and enable PASV passive mode like in 1st post here.
    • Which FTP client ? As not all FTP clients support FTP explicit TLS/SSL mode only clients listed at bottom of this post.
    • If you are having trouble with logging in using the generated pure-ftpd username and password, you can try changing the password for the pure-ftpd username with instructions outlined at Pure-FTPD Virtual FTP Users - CentminMod.com LEMP Nginx web stack for CentOS
    • Check if you're ISP IP address is being blocked by CSF Firewall. See FAQ items 40 & 41.
     
  20. Andy

    Andy Active Member

    540
    88
    28
    Aug 6, 2014
    Ratings:
    +131
    Local Time:
    12:15 AM
    Having a similar issue. I was given a new server without root access. However, the account provided to me was added to sudoer list so I should not have any issue.
    I was able to sudo everything and install centminmod, add a vhost, etc,

    There are few things that are not working with sudoer account
    1) sudo: cmdir: command not found
    2) I can't go to the pubic folder of the vhost I just created.
    sudo cd /home/nginx/domains/xxx/public
    This will not do anything