Discover Centmin Mod today
Register Now

sed command doesn't work for motd file?

Discussion in 'System Administration' started by pamamolf, Sep 27, 2015.

  1. pamamolf

    pamamolf Well-Known Member

    2,819
    253
    83
    May 31, 2014
    Ratings:
    +447
    Local Time:
    12:20 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    Hi :)

    I try to use this as root:

    Code:
    sed -i 's/ENABLEMOTD='y'/ENABLEMOTD='n'/' /usr/local/src/centminmod/inc/motd.inc
    *the path is ok as i can use nano and i am able to view the content of the motd.inc

    but it doesn't replace it with ENABLEMOTD='n' :(

    Any ideas?

    And if i disable it using ENABLEMOTD='n' do i have to restart anything ?
     
    Last edited: Sep 27, 2015
  2. eva2000

    eva2000 Administrator Staff Member

    30,940
    6,913
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,409
    Local Time:
    8:20 PM
    Nginx 1.13.x
    MariaDB 5.5
    double quotes when you are replacing single quoted text
    Code:
    sed -i "s/ENABLEMOTD='y'/ENABLEMOTD='n'/" /usr/local/src/centminmod/inc/motd.inc
     
    • Like Like x 1
    • Informative Informative x 1
  3. pamamolf

    pamamolf Well-Known Member

    2,819
    253
    83
    May 31, 2014
    Ratings:
    +447
    Local Time:
    12:20 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    I just disable it and disconnect from ssh and connect back but i got it again :(
     
  4. eva2000

    eva2000 Administrator Staff Member

    30,940
    6,913
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,409
    Local Time:
    8:20 PM
    Nginx 1.13.x
    MariaDB 5.5
    no that doesn't disable MOTD on log in, it only prevents centmin mod itself from overwriting the /etc/motd contents with centmin mod's own template so that you can empty /etc/motd and not have centmin mod re-populate it with it's own template
     
  5. pamamolf

    pamamolf Well-Known Member

    2,819
    253
    83
    May 31, 2014
    Ratings:
    +447
    Local Time:
    12:20 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    How can i disable it?

    Or i can just edit the /etc/motd and by setting it to =n will be fine after updates?
     
  6. eva2000

    eva2000 Administrator Staff Member

    30,940
    6,913
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,409
    Local Time:
    8:20 PM
    Nginx 1.13.x
    MariaDB 5.5
    as the motd says
    Code:
    # To edit this message,
    # 1). edit /etc/motd
    # 2). edit inc/motd.inc and set to no ENABLEMOTD='n'
     
    • Like Like x 1
  7. Jon Snow

    Jon Snow Active Member

    202
    29
    28
    Jun 30, 2017
    Ratings:
    +38
    Local Time:
    6:20 AM
    Nginx 1.13.4
    MariaDB 10.1.26
    Do you need to reboot the server for this to take effect?

    Using the following command doesn't work :
    Code (Text):
    service sshd restart

    The second line from your instruction is (unless I'm missing something) :
    Code (Text):
    /usr/local/src/centminmod/inc

    Since inc/motd.inc does not exist.
     
    Last edited: Jul 28, 2017
  8. eva2000

    eva2000 Administrator Staff Member

    30,940
    6,913
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,409
    Local Time:
    8:20 PM
    Nginx 1.13.x
    MariaDB 5.5
  9. Jon Snow

    Jon Snow Active Member

    202
    29
    28
    Jun 30, 2017
    Ratings:
    +38
    Local Time:
    6:20 AM
    Nginx 1.13.4
    MariaDB 10.1.26
  10. eva2000

    eva2000 Administrator Staff Member

    30,940
    6,913
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,409
    Local Time:
    8:20 PM
    Nginx 1.13.x
    MariaDB 5.5
  11. Jon Snow

    Jon Snow Active Member

    202
    29
    28
    Jun 30, 2017
    Ratings:
    +38
    Local Time:
    6:20 AM
    Nginx 1.13.4
    MariaDB 10.1.26
    So do I need to create the file /etc/centminmod/custom_config.inc with those contents to disable it?

    And where do I add my own custom text?
     
  12. eva2000

    eva2000 Administrator Staff Member

    30,940
    6,913
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,409
    Local Time:
    8:20 PM
    Nginx 1.13.x
    MariaDB 5.5
    yup, this ensures centmin mod updates not overwrite the variables as what is set in custom_config.inc persists

    right now there isn't an easy way for that which doesn't get overwritten on centmin mod updates as the script that displays the MOTD on login is part of centmin mod git based repository which gets updated when centmin mod updates

    what are you trying to add ?
     
  13. Jon Snow

    Jon Snow Active Member

    202
    29
    28
    Jun 30, 2017
    Ratings:
    +38
    Local Time:
    6:20 AM
    Nginx 1.13.4
    MariaDB 10.1.26
    You know how people create things like these by just using keys from the keyboard?

    [​IMG]

    Or some nice quotes (like from Star Wars).

    Eh, it's not really too important.
     
    • Funny Funny x 1
  14. eva2000

    eva2000 Administrator Staff Member

    30,940
    6,913
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,409
    Local Time:
    8:20 PM
    Nginx 1.13.x
    MariaDB 5.5
    oh i see hehe