Friday, March 30, 2012

Restrict Logins

Hi All:
I'm running SQL Server 7 in an NT environment using SQL Server
Authentication for the logins.
I'm a developer who has recently accepted the responsibilities for SQL
Server maintenance. I'm not really qualified to do this, but I'm
learning. Lord knows I need all the help and suggestions I can get;
I'm readily maintaining the status quo and make any modifications only
after what I consider exhaustive testing on our "test server". I've
just been handed the task of restricting certain logins to a specific
machine.
I do know that when I look at the running processes in EM I can see
the machines the users are connecting from.
Is there some way I can trap this information, issue an alert that
will start a job to kill the offending process? Or, is there some way
I can use DMO to do this'
I had originally thought that maybe I could intercept the login and
make the appropriate checks and deny the login... But, I haven't
found anything that indicates this approach is "do-able".
Then I found the active processes information and I began to wonder if
there wasn't some way to trap this information and issue a process
kill all in unattended mode.
I'm a developer and am not "married" to the EM ( it does make life and
learning easier).
Any and all help and suggestions are definitely appreciated.
TIA,
cathyHi,
If it is SQL Server Login or Windows user connecting to SQL server then you
can DENY the user to access the tables, If it is Host name
then you cant deny or revoke directly , But you can follow the below steps
to kill the user.
1. Create a script which looks like:-
use master
go
declare @.x varchar(1000)
set @.x=''
select @.x = @.x + ' kill ' + convert(varchar(5), spid)
from master.dbo.sysprocesses
where hostname = 'host_name' -- replace this with the actual host name
exec (@.x)
go
2. Schedule this script every 1 minute daily in SQL Agent -- Jobs. This will
check and the process if it logs in from the host name you mentioned.
Thanks
Hari
MCDBA
"Catherine Finnegan" <remove_for_nospam_caeriel1@.cablespeed.com> wrote in
message news:erfa90tjrncj89pugk4qr1bp7trkegui5n@.
4ax.com...
> Hi All:
> I'm running SQL Server 7 in an NT environment using SQL Server
> Authentication for the logins.
> I'm a developer who has recently accepted the responsibilities for SQL
> Server maintenance. I'm not really qualified to do this, but I'm
> learning. Lord knows I need all the help and suggestions I can get;
> I'm readily maintaining the status quo and make any modifications only
> after what I consider exhaustive testing on our "test server". I've
> just been handed the task of restricting certain logins to a specific
> machine.
> I do know that when I look at the running processes in EM I can see
> the machines the users are connecting from.
> Is there some way I can trap this information, issue an alert that
> will start a job to kill the offending process? Or, is there some way
> I can use DMO to do this'
> I had originally thought that maybe I could intercept the login and
> make the appropriate checks and deny the login... But, I haven't
> found anything that indicates this approach is "do-able".
> Then I found the active processes information and I began to wonder if
> there wasn't some way to trap this information and issue a process
> kill all in unattended mode.
> I'm a developer and am not "married" to the EM ( it does make life and
> learning easier).
>
> Any and all help and suggestions are definitely appreciated.
> TIA,
> cathy

No comments:

Post a Comment