LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   how to issue a message prior to login prompt for a particular user (https://www.linuxquestions.org/questions/programming-9/how-to-issue-a-message-prior-to-login-prompt-for-a-particular-user-109374/)

mtest 10-28-2003 03:17 AM

how to issue a message prior to login prompt for a particular user
 
I want to issue a command prior to login prompt from root for a particular user.
but when i write echo "Contact System Admin" >> /etc/issue, it is showing the message to all users.
I want to issue for a particular user
pls reply this

worldmagic 10-28-2003 05:03 AM

Prior to login, you dont know who the user are.. how could you present a message just to one user? You have to present the message after logon. Or write something like this in /etc/issue: "JoeUser please contact System Administrator"

mtest 10-28-2003 05:47 AM

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 else.

so can u tell how this can be acheived.

SaTaN 10-28-2003 05:52 AM

Add this line

echo "Meet system administrator"
in that particular user's .bashrc or .bash_profile

Then as soon he logs in he gets that message

worldmagic 10-28-2003 08:59 AM

Or you compile a small program that echo outs "You banned" and then terminates, you set the users shell in /etc/passwd to this program.. That would do what you request =)

mtest 10-29-2003 12:24 AM

Mr Satan thanks for ur help.
keeping the message in .bashrc or .bash_profile will issue a message whenever the user logs in, but the user will do his work. what i need is after the message is displayed the user must be suspended from work

infamous41md 10-29-2003 12:50 AM

write a program that will be invoked as the user's shell when he logs in. your program will do filtering, and either execute the user's default shell or terminate.

mtest 10-29-2003 02:03 AM

thanks MR infamous41md for ur quick reply.
but i didn't understand this. can u clearly explain this again
sorry for troubling u.

Looking_Lost 10-29-2003 07:40 AM

There doesn't seem much point in letting them log in but then try and stop them doing anything once they are logged in.

It's probably just easier to change their login shell to /bin/false or whatever and wait for them to come running to you

but as simple as it gets I guess is adding to there .bash_profile

echo "Please contact admin, bad guy"
logout

which will log them out straight away

SaTaN 10-29-2003 08:25 AM

Even I too agree with Looking_Lost

But just joking :-

Suppose your bad guy is really intelligent n after he has been logged off once, he'll know that you have changed his .bash_profile

Maybe he'll ftp an another .bash_profile onto his login :-
You'll have to disable his ftp as well.

Just joking , I personally don't think he'll be doing it . He'll be rushing to system administrator

P.S :- I did it once when a friend of mine put a logout in my bash_profile for fun.

Looking_Lost 10-29-2003 08:40 AM

Assuming they managed to bypass the biometric scan security layer, doesn't everyone use it ? Plugs right into your serial port scans the iris and doubles up as a barcode reader
:)

mtest 10-30-2003 01:29 AM

Mr SATAN
can u tell how to ftp an another .bash_profile onto their own login
thanks in advance

SaTaN 10-30-2003 02:36 AM

It's just as you ftp an another file

Ok follow these sequence of steps
Get into the login of ur friend [Let us say donor]
On his konsole type these
Code:

[donor@students donor]$[COLOR=dark red] ftp 192.168.36.205[/COLOR]
Connected to 192.168.36.205 (192.168.36.205).
220 (vsFTPd 1.1.3)
Name (192.168.36.205:donor):[COLOR=dark red]bad_guy[/COLOR]
331 Please specify the password.
Password:[COLOR=dark red]****[/COLOR]
230 Login successful. Have fun.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>[COLOR=dark red]bin[/COLOR]
200 Switching to Binary mode.
ftp> [COLOR=dark red]mput .bash_profile[/COLOR]
mput .bash_profile? [COLOR=dark red]y[/COLOR]
227 Entering Passive Mode (192,168,36,205,216,240)
150 Ok to send data.
226 File receive OK.
14 bytes sent in 5.7e-05 secs (2.4e+02 Kbytes/sec)
ftp>[COLOR=dark red]bye[/COLOR]
[donor@students donor]$

All things in red should entered by user

You can even use scp for this
Check man scp for this

paonethestar 10-30-2003 02:58 AM

If u give just access permissions to .bash_profile for the perticular user as root,Is it possible to override .bash_profile when u did ftp ??.Just a dout!.

SaTaN 10-30-2003 03:01 AM

access permissions ???

can u be a bit more clear abt it


All times are GMT -5. The time now is 03:15 AM.