473,651 Members | 2,994 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create a database login in the default domain

I'm trying to create a login in the default domain. I know I can pull
this information from xp_loginconfig, but don't see how I can use it in
the context of sp_grantlogin.

For example, pull the domain the user is currently logged in on and
insert it into the sp_grantlogin script. Has anyone ever done this in
the past?

Jul 23 '05 #1
2 2730

"Aaron" <aa********@yah oo.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
I'm trying to create a login in the default domain. I know I can pull
this information from xp_loginconfig, but don't see how I can use it in
the context of sp_grantlogin.

For example, pull the domain the user is currently logged in on and
insert it into the sp_grantlogin script. Has anyone ever done this in
the past?


First of all, I strongly suggest that you consider adding domain accounts to
a domain group, and then just grant login to the group - that's much easier
to manage (and it's the MS recommended way to implement security).

I'm not sure I really understood your question - do you mean that given the
Windows domain account name 'Someone', you want to find the default domain
name from xp_loginconfig (let's call it SOMEDOMAIN), and then grant login to
'SOMEDOMAIN\Som eone'? If so, see the (untested) code below.

If I misunderstood you, you might want to give a specific example of what
you're trying to do.

Simon

create proc dbo.GrantLogin
@Account sysname
as
begin
declare @Domain sysname,
@Login sysname

create table #t
(Attrib sysname, Val sysname)

insert into #t exec master..xp_logi nconfig

select @Domain = Val
from #t
where Attrib = 'default domain'

set @Login = @Domain + '\' + @Account

exec sp_grantlogin @Login
end
Jul 23 '05 #2
Great, this seems perfect. Thanks for your help.

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3038
by: lkrubner | last post by:
I have a webserver through Rackspace. I create a domain. I create an FTP user. I upload some files. I create a database called testOfSetupScript and then I create a database user named setup. I write some PHP code which should, I think, be able to to auto create the tables. The SQL looks like this:
14
2262
by: frizzle | last post by:
Hi Group, I have a site with a MySQL backend. It has a member-system. Members login with a small login-form that appears on every page (via include()) If members are logged in, the form disappears and a few extra links appear instead of the form. - If members log in, i want to redirect them, if succesful, back to the page they logged in from.
2
9578
by: Nans | last post by:
One basic ASP.NET database issue…. I have a c# app running on a iis6 on one win2k3 adv servermachine & database on other win2k server machine…(in the same domain) Using windows authentication in web.config. Set impersonate =true . Connection string has Integrated security=SSPI. Logging in with my ID which is system administrator and has rights all DBs on the sql machine. But still, I get this error..(even I tried putting for test...
11
3060
by: Andre | last post by:
Hi, I have ASP.NET application running on standalone (not part of the domain) Windows 2003. I use forms authentication for my application. The problem I have is that I need to create and read files on Windows domain network shared drives and also on shared via Samba Unix drives, which is equivalent to writing/reading to the workgroup computer. Please point, if possible, to detailed step by step description of what needs to be done. Thank...
4
4071
tolkienarda
by: tolkienarda | last post by:
Hi all I work for a small webdesign company and we have remote hosting. i built a mysql database with phpmyadmin on the server. i then downloaded and modified a php login page. i am continuing to get the ---invalid username or password--- i am not getting the E_USER_ERROR so i don't know if there is a problem with the php, how i set up the database or mabe somthing in between. so everyone knows all of my server interface is GUI. I use a company...
6
9880
by: =?Utf-8?B?UGFyYWcgR2Fpa3dhZA==?= | last post by:
Hi All, We have a requirement where we have to develop a custom Login Page which will accept user's NT credentials ( Username , password, domain name). This then needs to be passed to a website which uses Windows Authentication Now my question is how do we pass these credentials to IIS in classic ASP? Would appreciate any help/pointers on this. Thanks in advance.
1
15211
by: eblackmo | last post by:
I have a test network consisting of four servers running windows 2003 server R2 SP2. I have set up a domain which functioned correctly for about a day and a half until the other servers decided they can no longer connect to the domain controller. Ping resolves the domain controllers name to the correct ip nslookup finds the ip but can not resolve the name. When I attempt to log on to a machine on the domain it takes around twenty minutes...
6
1709
by: =?Utf-8?B?UGFycm90?= | last post by:
I cannot access my SQL database in a browser control created in my C# Windows application program I can, however, access the database from an IE browser. I get the ubiquitous "Login failed for NT AUTHORITY\NETWORK SERVICE" error message. I researched all the advice on the internet and tried to add an NT AUTHORITY\NETWORK SERVICE login to my database under the Security/Users tab using SQL Server Mangement. However, there is no NT...
3
1361
by: David C | last post by:
I am getting the message below trying to open the SQL 2005 db in default.aspx. System.Data.SqlClient.SqlException: Cannot open database "Mydata" requested by the login. The login failed. Login failed for user 'MYXP\generic' The web site is on an XP machine with 2005 Express. I setup a login called generic on our domain and then put that login and password into the identity impersonate section of web.config
0
8807
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8466
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8584
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7299
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4144
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4290
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2701
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1912
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1588
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.