Link to home
Start Free TrialLog in
Avatar of SmashAndGrab
SmashAndGrab

asked on

Is there a way to securely send a an OSQL command?

Hi,

I am sending an OSQL command from one server to another that is executed via a batch file.  The command starts an SQL Job.

sqlcmd.exe -S "MyServerName" -U *myUser* -P *myPassword* -Q"exec msdb.dbo.sp_start_job ' TEST'"

The problem is that the OSQL command contains the username, password and server name.

I am worried about security.

Is there a way of doing this securely?  

Thanks

Stuart
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

yes, using windows authentication.
this means that instead of -U<username>  -P<password> you just end up with -E
https://technet.microsoft.com/en-us/library/aa214012%28v=sql.80%29.aspx

this requires that your batch file is executed with a windows user (if this is run from a scheduler, this needs to be configured there) that is defined in the sql server side as login and being granted the necessary rights
Avatar of SmashAndGrab
SmashAndGrab

ASKER

Hi Guy,
thanks.


The batch file is executed from a program (Crystal Reports).   I assume that the Crystal user would need the relevant permissions?
If so, where would the Crystal user permissions need to be granted?
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
looking at this right now..