当前位置:网站首页>Based on authorized access, cross host, and permission allocation under sqlserver
Based on authorized access, cross host, and permission allocation under sqlserver
2022-07-06 14:21:00 【Code siege lion】
1. Open the remote access rights of the installed database ;
To the server to be accessed , The login mode set in security is sql server and windows Authentication mode login
Sign in sa After account , In the status bar , Allow connections to the database engine
2. Create a user , Grant them access to the database ;
– Create a login account
create login xuniji with password=‘123456’
When the host acts as a client , use sa Account login to access the server of the virtual machine
It uses the host's (192.168.1.2) Of DBMS, Account sa, The address to visit is 192.168.1.3
use xuniji When logging in to this account , It is forbidden to log in and access the database without authorization
After authorization :
use Company This sentence is indispensable , If it is to let the login user access a specific database
– Create database users
create user xuniji for login xuniji with default_schema=dbo
Access all databases : Access all databases without adding use company
EXEC sp_grantdbaccess ‘xuniji’
GO
You can visit
3. The query and insert permissions of one or more specific tables form a role , And grant it to the user ;
grant select,insert on Department to xuniji
grant select,insert on Employees to xuniji
This statement gives the permission to query and insert to xuniji The name of this character , It can also be called login , Because I created one before xuniji The role name of and the login name of a virtual machine , Mapping relationship has been established , So there is no need to map here
After authorization, both insert and query can be executed successfully , The authorization here is to use the host sa Account authorization , And I insert and query with xuniji This account .
4. Choose a partner in the class or group , Let it access remotely through the set user , And complete and insert
operation ;
I used it 3 Middle method implementation :
One 、 The first is to establish a simulated environment through virtual machines (windows7x64 position ,sqlserver2012).
Two 、 The second is to connect the computer directly with two network cables
3、 ... and 、 The third way is to connect through the LAN under the router
1、 The two machines to establish remote access must be in the same network segment .
Hosts and virtual machines ( Machines that need access ) Both must be in the same network segment
The gateway I set is 192.168.1.1
host IP The address is 192.168.1.2
virtual machine IP The address is 192.168.1.3
among 192.168.1.0 Cannot set , Because this is the broadcast address
The subnet mask is set to 255.255.255.0( Subnet mask is used to allocate address space )
My address space allocation space is 2~254 All the machines in the segment can access each other .
virtual machine :IP Address
W1064 Bit host IP Address :
( After the environment is established, pass the command ping Conduct ping through )
2、 commonly windows7 In the environment , There is no need to change the port. The default is 1433 port , But my host (windows10,sqlserver12) Port is not 1433 Need to use sqlserver Configure in the configuration manager
Windows10 Generally, the default port is empty , Can be in IPall Set in the for 1433.
3、 Login with user name and password sa Login is usually the user with the highest permission , Generally, the login name is set in the target machine that needs to be accessed ( This login name is usually not sa):
virtual machine (192.168.1.3) Go to the database Company323 There is no table
5. Withdraw the insert permission of the table .
When I finish deleting authorization , You cannot insert any more :
边栏推荐
- Library management system
- 实验七 常用类的使用
- 《统计学》第八版贾俊平第十四章指数知识点总结及课后习题答案
- Harmonyos JS demo application development
- 记一次api接口SQL注入实战
- Package bedding of components
- 7-4 hash table search (PTA program design)
- Network layer - simple ARP disconnection
- Harmonyos application development -- address book management system telmanagesys based on listcontainer [phonebook][api v6]
- Experiment 4 array
猜你喜欢
网络基础之路由详解
记一次api接口SQL注入实战
搭建域环境(win)
Hackmyvm target series (5) -warez
Detailed explanation of network foundation routing
Detailed explanation of network foundation
Network layer - simple ARP disconnection
[dark horse morning post] Shanghai Municipal Bureau of supervision responded that Zhong Xue had a high fever and did not melt; Michael admitted that two batches of pure milk were unqualified; Wechat i
《统计学》第八版贾俊平第十四章指数知识点总结及课后习题答案
Middleware vulnerability recurrence Apache
随机推荐
记一次edu,SQL注入实战
图书管理系统
JS several ways to judge whether an object is an array
7-3 construction hash table (PTA program design)
XSS之冷门事件
网络基础之路由详解
7-15 h0161. Find the greatest common divisor and the least common multiple (PTA program design)
Hackmyvm Target Series (3) - vues
Detailed explanation of three ways of HTTP caching
Chain team implementation (C language)
Intranet information collection of Intranet penetration (4)
Detailed explanation of network foundation
MSF generate payload Encyclopedia
HackMyvm靶机系列(5)-warez
Tencent map circle
Mathematical modeling idea of 2022 central China Cup
攻防世界MISC练习区(gif 掀桌子 ext3 )
Experiment 6 inheritance and polymorphism
Detailed explanation of network foundation routing
JDBC transactions, batch processing, and connection pooling (super detailed)