LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-13-2011, 01:45 PM   #1
smithy2010
Member
 
Registered: May 2010
Location: UK
Distribution: OpenSuse 64 bit
Posts: 45

Rep: Reputation: 15
Talking emil me on boot


Hello all,

I want to setup my Fedora 15 computer to email me every time it boots and I want computer to email me before a user logs in. Can you advice how I can achieve this?

Thank you in advance

Smithy
 
Old 06-13-2011, 01:53 PM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

You could add a command to mail you in the /etc/rc.local file, which is the last init file executed when booted. For the users, you could add something similar to the .bashrc or .bash_profile file in their home directory but you'll have to make it immutable or they will be able to change it. Those are only some options, I'm sure there will be more posted shortly.

In either case, you'll have to make sure that your server is set up to deliver mail and that it's functioning correctly (test it).

Kind regards,

Eric
 
Old 06-13-2011, 02:24 PM   #3
flakblas
Member
 
Registered: Jun 2009
Location: Maryland
Distribution: Fedora, CentOS, RHEL, Ubuntu
Posts: 41

Rep: Reputation: 3
I would use the rc.local method for when the system boots but I wouldn't use the bashrc method for when users login as this is extremely easy to circumvent. I'd write a script that scrapes lastlog or something then runs a command like:
Code:
mail -s "$username logged in - $(date)" youremail@domain.tld </dev/null
 
Old 06-14-2011, 12:29 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
You can add the email cmd to /etc/profile (for 2nd qn) as this is run as user logs in, but before their personal bash_profile/bashrc files are called and (should be) only accessible by root.
 
Old 06-14-2011, 06:40 AM   #5
flakblas
Member
 
Registered: Jun 2009
Location: Maryland
Distribution: Fedora, CentOS, RHEL, Ubuntu
Posts: 41

Rep: Reputation: 3
Quote:
Originally Posted by chrism01 View Post
You can add the email cmd to /etc/profile (for 2nd qn) as this is run as user logs in, but before their personal bash_profile/bashrc files are called and (should be) only accessible by root.
Ah good call.
 
Old 06-14-2011, 12:21 PM   #6
smithy2010
Member
 
Registered: May 2010
Location: UK
Distribution: OpenSuse 64 bit
Posts: 45

Original Poster
Rep: Reputation: 15
Thank you all, I'll try what you suggested and come back if I have any questions.

Cheers

Smithy
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Boot Camp (fixing boot loaders, learning your way around boot & chainloaders) Siljrath Linux - General 8 01-20-2015 11:00 AM
Is it better on dual boot,trible boot,quad boot rather than virtual machines? pleasehelpme Linux - Newbie 3 12-15-2007 12:04 PM
When I boot my comp. (dual boot sys-Suse 10.1 & Win XP) the first boot stalls. philip niedermeyer Linux - Desktop 5 11-13-2006 06:04 PM
Kind souls: help getting Mandriva install 2 boot? edit boot.ini/grub /boot device or NoMoreReinstallMS Linux - Newbie 1 08-09-2006 04:34 AM
GRUB: How to boot WinXP (NTLDR, NTDETECT.COM & BOOT.INI) from boot partition (EXT2) ? Rayen16 Linux - Software 1 05-25-2006 12:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration