Help with script to stop a user giving kill command on a server!!
Hi,
I am new to shell scripting and want to create a script with the follwoing description:
I want to restrict the users from giving a kill command on a unix server. The server have a restricted logins with login id and passwords. I want a script that will find out if a user has given a kill command and if finded soem user that has given kill command, then promt that user not to give kill command. It should give an option to the logged in person " You should not use kill command but if you still wish to continue type yes else type no"
If the person types yes then he should give his details (unix id and password) that the script will authenticate and if passed then the person can give the kill command, provided i get his login details.
One way is to create an alias. Most users do not know anything about /usr/bin/kill,
they just use kill [pid]. This is a start on your requirements - I don't know what you mean by authenticate. Relogin?
Instead of specifying things like that, just tell us what you want to have happen.
You need to put this script somewhere that all of the users you describe have access to the file - just read/execute access:
Call the script, for example, /path/you/created/for/fake_kill.sh
Be sure to chmod +x /path/you/created/for/fake_kill.sh
Be sure all the directories of the path allow execute access for restricted users.
Add this to your login script for restricted users
Hey,
Thanks for the suggesstion. But i am a little confused. As mentioned in the script above, a fake_kill script will be created, so what will happen to /usr/bin/kill. Should that be deleted??
My requirement goes like this:
I want to warn the users if they are using kill command to kill some logins. I want to run this script on a server which has three login id's permitted(say abc/passowrd, cde, password, fgh/password). A user can telnet to that server and login using only these permitted id's whch are shared globally in our team. So the issue that we are facing is we are unaware which person gave kill command and forced out a person doing some activity on the server.
So, the script should check if anyone has given KILL command; it should warn the person; " not to use kill command" and then display an option yes/no as mentioned in the script above and stop the execution of kill command if the person enters no. And if the person enters yes, then it should ask the person to provide his unix id as he is logged into the server with some other login and after verifying his login details, we can allow that person to use kill command execution normally, as we will be aware who has given kill command.
I hope i made my requirement clear this time.
Thanks in advance
if your users are cooperative - simple wrapper is enough .
If they are malicious - it takes 3 min to write kill.c and compile it ( in case compiler is available )
Hi,
I need to create a shell script for automated server patching, with the following scenario:
I have two Linux servers Primary and secondary.
Server patching should start on Primary 1st and then secondary.
1st check both servers are up and running.
Then stop primary and patching will... (1 Reply)
Hi,
I simply want to kill a running process using a script that read pid from a file and tries to kill it .Getting error as shown below code..
cat $HOME/BackupScript.ksh.run | head -1 | while read pid
do
ps -p $pid > /dev/null 2>&1
if ; then
kill -9 $pid
else
echo "no running $pid... (5 Replies)
Hi, I have googled for quite some time and couldn't able to get what exactly I am looking for.. My query is "how to stop a shell script which is running inside a remote server, using a script"??? can any one give some suggestions to sort this out. (1 Reply)
I am looking for a way to kill 2 processes from a user through some kind of script.
Using an oracle script, I get two process ids that need to be killed.
SQL> select ssn.process as client_process_id, pcs.spid as oracle_process_id, ssn.sid, ssn.serial#
2 from v$session ssn inner join... (5 Replies)
Hi,
In my shell script when I am using mv command using shell variables it is giving me error of syntax. Following is the shell script:
file_edifice="*.txt"
fquote="'"
fdquote=\"
for file in $file_edifice
do
file_name=$fquote$file$fquote
tofile_name=`date... (5 Replies)
Hello list,
Have a problem that's highlighting gaps in my knowledge; can you assist?
We have a script that's tacked onto our trading application which allows branch managers etc. to kill off the sessions of other users at their branch. A menu option in the application spawns a shell running... (8 Replies)
Hi ,
I have a situation, where I have 10 indivudal processess started by similar instance.I say similar instance because each of them being started as a new thread:
Say I've following unix process running
process1_ADAP
process2_ADAP
process3_ADAP
Current scenario:
Now I have SHUTDOWN... (5 Replies)
After installing Apache and configuring the httpd.conf file to listen
to port 80, I have come to find that there is another server on the
Sco box I'm working on. Would someone please tell me how to
stop or kill this server. The server is Netscape FastTrack Server.
Also, how might I remove all... (2 Replies)