LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-28-2003, 06:54 AM   #1
mtest
LQ Newbie
 
Registered: Oct 2003
Location: India
Posts: 22

Rep: Reputation: 15
how to flash a message to a specific user on login


i want to issue a message such as "Contact System Admin" for a particular user whenever that particular user logs in and the user work must be suspended i.e the user must not be allowed to do any thing.

so can u tell how this can be acheived.
 
Old 10-28-2003, 07:47 AM   #2
ouch!potato
LQ Newbie
 
Registered: Oct 2003
Location: Edinburgh, Scotland
Distribution: Redhat 9.0
Posts: 6

Rep: Reputation: 0
Just disable their account, they wont be able to do anything and they will contact the system admin ;-)
 
Old 10-28-2003, 02:25 PM   #3
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
Or you could
  • create a dummy shell by doing a script
    Code:
    #!/bin/sh
    echo "Contact System Admin"
    sleep 5s
    and storing it to for example /usr/local/bin/noaccount.
  • run chmod +x /usr/local/bin/noaccount to give users a right to run that command.
  • Set that to default shell for the user in question, that is
    Code:
    chsh -s /usr/local/bin/noaccount theuser
Now when the user logs in, a shell is not spawned, but a message in question is shown, and the system waits for 5 seconds and logs the user out.
 
Old 10-29-2003, 01:54 AM   #4
mtest
LQ Newbie
 
Registered: Oct 2003
Location: India
Posts: 22

Original Poster
Rep: Reputation: 15
thanks mr tonit for ur reply. it suits well for my question
I didn't understand this clearly. I didn't find any file in /usr/local/bin/

so pls can u clearly explain this.
sorry for troubling u.
 
Old 10-29-2003, 10:13 AM   #5
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
The first bullet was: "create a dummy shell"", where create is
Quote:
From Webster's Revised Unabridged Dictionary (1913) [web1913]:

Create \Cre*ate"\, v. t. [imp. & p. p. {Created}; p. pr. & vb.
n. {Creating}.]
1. To bring into being; to form out of nothing; to cause to
exist.

In the beginning, God created the heaven and the
earth. --Gen. i. 1.
Meaning that there shouldn't be such file already, but you should make one.
How? With your favorite text editor(cat,vim, emacs, I don't care). What contents? The tree lines said in my first post. With what name? Pick any name that describes the usage of the program/shell; I have used "noaccount" in my example.
Why is it stored to /usr/local/bin? Because /usr/local that is a place where local administrator should put all executables that are not part of the distribution/packgage management(see Filesystem Hierarchy Standard for rationale) and an ordinary user could need them (in this case, atleast one user needs this program as his/her shell substitute).


The shell is dummy in sense of its complexiness, you can do a lot less with a shell that
only prints a line and quits than an ordinary shell.

Last edited by ToniT; 10-29-2003 at 10:14 AM.
 
Old 10-30-2003, 02:36 AM   #6
mtest
LQ Newbie
 
Registered: Oct 2003
Location: India
Posts: 22

Original Poster
Rep: Reputation: 15
thanks tonit,
I tried this and it worked well.
it helped me a lot.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to setup system Login banner and Login message 06-03-05 Linux - Newbie 13 07-24-2020 03:05 PM
Auto-login at specific times Vorik Linux - Software 6 12-11-2007 02:04 AM
To restrict a specific user simi_virgo Linux - Newbie 1 02-26-2005 01:03 AM
specific USB Flash Disk not being mounted on Red hat 9 on kernel 2.4.20 irfanhab Linux - Hardware 3 01-30-2004 05:19 AM
how to issue a message prior to login prompt for a particular user mtest Programming 19 10-30-2003 07:41 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:40 AM.

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