Specifying domain in sqsh

4.5k views Asked by At

I'm trying to connect to my SQL Server from a Linux terminal using SQSH. The line is:

sqsh -S <ip address> -U <DOMAIN\user>

which throws an error:

Msg 18456, Level 14, State 1 Server 'DC2', Line 1
Login failed for user ''.

Notice that it seems to have removed the '\' which separates my domain and user.

On the server side, my event log confirms the same thing. The event reads:

Login failed for user 'DOMAINuser'.
Reason: Could not find a login matching the name provided.

I've tried using single and double quotation marks to encapsulate the domain and user name, but when I do that, the request does not even make it to the server, probably because the quotes signify something else syntactically.

Does anyone know what I'm doing wrong?

1

There are 1 answers

2
Laughing Vergil On

sqsh uses the FreeTDS configuration file by default, so the version of TDS can be specified. A full description can be found here, but the command line result should look like this:

sqsh -S<config file name> -D <database name> -U <domain>\\<user> -P <password / hash>

Example:

sqsh -S mssql -D MyDB -U DOMAIN\\testuser -P MyTestingClearPassword1