Find the answer to your Linux question:
Results 1 to 7 of 7
Hi, I'm a linux newbie user, I have a Ubuntu server for tryouts and testings, my problem is that I would like to set any kind of script of something ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2005
    Posts
    8

    Generating automatically a motd file


    Hi, I'm a linux newbie user, I have a Ubuntu server for tryouts and testings, my problem is that I would like to set any kind of script of something that write the motd file everytime any user logs in using ssh, because I have found that sometimes people who log in this server keep changing and writing stupid things in the motd file so the others can see whenever they log. I want to set the motd file so it's only one and it doesn't matter if someone just logs in (with root account), even if they rm the /etc/motd it will be generated automatically next time another users logs in. Can this thing be done?

  2. #2
    Linux Engineer Giro's Avatar
    Join Date
    Jul 2003
    Location
    England
    Posts
    1,219
    Not really if they have root access they can undo anything you have done.

  3. #3
    Just Joined!
    Join Date
    May 2005
    Posts
    8
    I know that, but the problem is that server is a test server, so, a lot of students (because it's a university test server) have the root pass, so, many of us could change that and uno the changes that others do. So, do you know how to do what I asked before?

  4. #4
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    You could run a cron job every minute to copy the motd file from a known location. Or write a script to do it, with the motd content embedded. However, a malicious user with root access could still find the files and change them. root's powerful like that. Do many people really need root access?

  5. #5
    Just Joined!
    Join Date
    May 2005
    Posts
    8
    Yes, many people ( 5 persons) know about our server's root password, because it's OUR server, I mean, all the 5 of us mounted the server and colaborate for it.

    By the way, how can I do the cron job? I would like to know more about it, could you please teach me a little more?

  6. #6
    Just Joined!
    Join Date
    Apr 2005
    Posts
    88
    Greetings,

    Please refer to the following link to learn more about cron: http://www.linuxhelp.net/guides/cron/

    This will help u and will provide you the knowledge you require. Another thing for the Motd file I can suggest you to immunize the file using the chattr +i <file name>

    If you do this untill and unless you remove the +i thing no one wud be able to delete or able to change the contents of the file.

    Regards

  7. #7
    Just Joined!
    Join Date
    May 2005
    Posts
    8
    Thanks a lot! that servesme perfectly!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •