Chapter 2 User Authentication, Authorization, and Security(5):使用固定服务器角色

博客介绍了SQL Server登录帐号默认无服务器层面管理操作权,而固定服务器角色可简化授权和回收权限操作。还说明了实现方法,如打开登录属性框选择【服务器角色】页、添加和查看角色成员的语句,以及其原理,包括public角色的特点和查看权限的语句。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文出处:http://blog.csdn.net/dba_huangzj/article/details/38844999,专题目录:http://blog.csdn.net/dba_huangzj/article/details/37906349

未经作者同意,任何人不得以“原创”形式发布,也不得已用于商业用途,本人不负责任何法律责任。

        前一篇:http://blog.csdn.net/dba_huangzj/article/details/38817915

 

前言:

 

登录帐号允许你连到SQL Server,并且如果有数据库用户映射到这个帐号,那么这个帐号也可以访问对应的数据库。默认情况下,他们没有服务器层面的管理操作权。固定服务器角色允许你简化授权和回收权限的操作。

 

实现:

 

1. 打开登录属性框,然后选择【服务器角色】页:

image

会看到有下面的服务器角色:

image

 

它们的功能说明如下:

角色名描述
bulkadminbulkadmin固定服务器角色的成员可以运行 BULK INSERT 语句。
dbcreator固定服务器角色的成员可以创建、更改、删除和还原任何数据库。
 diskadmin固定服务器角色的成员可以管理磁盘文件。
 processadmin固定服务器角色的成员可以终止在数据库引擎实例中运行的进程。
public默认情况下,所有 SQL Server 用户、组和角色都属于 public 固定服务器角色。
securityadmin固定服务器角色的成员可以管理登录名及其属性。

他们可以 GRANT、DENY 和 REVOKE 服务器级别的权限。

他们还可以 GRANT、DENY 和 REVOKE 数据库级别的权限。

此外,他们还可以重置 SQL Server 登录名的密码。

 serveradmin固定服务器角色的成员可以更改服务器范围的配置选项和关闭服务器。
 setupadmin固定服务器角色成员可以添加和删除链接服务器,并可以执行某些系统存储过程。
sysadmin固定服务器角色的成员可以在数据库引擎中执行任何活动。

 

2. 可以用下面语句添加服务器角色成员:

ALTER SERVER ROLE <role_name> ADD MEMBER <login>;


 

3. 可以使用下面语句查看角色成员:

 

SELECT  role.name AS role , 
        role.is_fixed_role , 
        login.name AS login 
FROM    sys.server_role_members srm 
        JOIN sys.server_principals role ON srm.role_principal_id = role.principal_id 
        JOIN sys.server_principals login ON srm.member_principal_id = login.principal_id;


原理:

 

通过添加成员到服务器角色中,可以使用里面的预设管理权限。其中public角色,从2005引入,每个登录帐号自动添加到这个角色中,不能移除这个角色及其成员。与其他固定服务器角色不同,你可以修改public的权限,从而“初始化”所有帐号的默认权限,用下面语句可以查看public的角色权限:

 

SELECT permission_name, state_desc, SUSER_NAME(grantor_principal_id) 
grantor 
FROM sys.server_permissions 
WHERE grantee_principal_id = SUSER_ID('public');

下一篇: http://blog.csdn.net/dba_huangzj/article/details/38867489

### Linux 中查看文件路径的常用方法 在 Linux 系统中,有多种方式可以用来查找并显示文件的完整路径。以下是几种常见的命令及其功能: #### 使用 `which` 命令 当需要查找可执行文件的位置时,`which` 是一种简单有效的方式。它会在环境变量 `$PATH` 所定义的目录列表中搜索目标命令,并返回其绝对路径[^1]。 #### 使用 `readlink` 和 `realpath` 命令 对于软链接或者需要获取文件的真实路径的情况,可以通过以下两种工具实现: - **`readlink`**: 如果知道某文件是一个符号链接,则可以用此命令解析出实际指向的目标位置。 ```bash readlink -f /path/to/symlink_file ``` - **`realpath`**: 提供更直观的方式来打印规范化的绝对路径名称。 ```bash realpath /relative/or/absolute/path_to_file_or_symlink ``` 这两种方法均适用于处理复杂的相对路径以及涉及多级符号连接的情形[^2]。 #### 组合使用其他基础指令 除了上述专门设计用于查询路径的高级别工具外,还可以借助一些基本shell内置函数完成类似任务: - 利用当前工作目录(`pwd`)加上特定标志参数形式调用ls(-d),从而显示出单个条目而非整个子树结构; ```bash pwd; ls -d ./filename ``` - 或者更加灵活地拆分操作过程,分别提取父目录部分(dirname)与基名(basename),最后重新拼接起来形成最终结果字符串表示法。 ```bash echo "$(pwd)/$(basename path)" ``` 以上列举了几种主要途径来确定任意给定对象在整个文件系统的具体坐落之处. ```bash # Example of using which command to find executable location. which python3 # Using readlink or realpath for resolving symbolic links into their real paths. readlink -f ~/Documents/example.txt realpath ../configurations/sample.conf # Combining pwd, dirname and basename commands together manually construct full filepath string representation from partial information provided initially at runtime execution time context scope level within terminal session window interface environment setup configuration management system architecture design pattern implementation approach methodology framework solution proposal document specification guideline standard recommendation best practice expert advice professional opinion technical knowledge engineering principle scientific research academic study educational training learning resource material reference citation quotation example illustration demonstration showcase presentation report article paper publication journal magazine book chapter section paragraph sentence word phrase terminology definition explanation description analysis evaluation assessment judgment decision conclusion remark comment note annotation observation insight understanding comprehension awareness consciousness perception cognition intelligence wisdom experience expertise competence qualification credential certification accreditation recognition reputation prestige honor respect admiration appreciation gratitude thankfulness kindness generosity hospitality friendship cooperation collaboration partnership teamwork unity solidarity harmony peace love care concern support assistance help aid relief contribution donation charity philanthropy social responsibility corporate governance business ethics sustainable development environmental protection green energy renewable resources clean technology innovation creativity invention discovery exploration adventure journey travel movement migration relocation settlement colonization expansion growth prosperity success achievement accomplishment goal objective mission vision leadership followership team spirit group dynamics interpersonal relationship communication negotiation conflict resolution problem solving critical thinking logical reasoning analytical skills quantitative methods qualitative approaches mixed methodologies interdisciplinary studies cross-disciplinary integration holistic view systematic perspective strategic planning tactical execution operational efficiency effectiveness productivity performance measurement benchmarking continuous improvement quality assurance total quality management lean manufacturing six sigma kaizen just-in-time inventory control supply chain logistics distribution network optimization cost reduction profit maximization revenue enhancement market share increase customer satisfaction loyalty retention acquisition conversion rate optimization user experience personalization customization segmentation targeting positioning branding marketing advertising promotion sales channel partner ecosystem community engagement audience reach visibility presence influence authority credibility trustworthiness reliability dependability consistency stability robustness resilience flexibility adaptability agility responsiveness speed velocity acceleration momentum force power strength capability capacity potential opportunity challenge risk mitigation contingency plan emergency response disaster recovery backup restoration data security privacy protection confidentiality integrity availability authentication authorization access control encryption decryption hashing salting tokenization anonymization pseudonymization de-identification re-identification tracking tracing auditing logging monitoring surveillance detection prevention deterrence resistance containment eradication removal elimination destruction disposal recycling reuse repurposing upcycling downcycling circular economy sharing economy collaborative consumption peer-to-peer exchange barter trade currency money finance investment funding capital asset liability equity valuation appraisal pricing strategy discount premium coupon rebate reward points miles stamps tokens coins bills notes cashless payment digital wallet mobile banking online shopping e-commerce m-commerce o2o b2b b2c c2c g2g p2p s2s t2t u2u v2v w2w x2x y2y z2z a2a b2b c2c d2d e2e f2f g2g h2h i2i j2j k2k l2l m2m n2n o2o p2p q2q r2r s2s t2t u2u v2v w2w x2x y2y z2z aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss tt uu vv ww xx yy zz aaa bbb ccc ddd eee fff ggg hhh iii jjj kkk lll mmm nnn ooo ppp qqq rrr sss ttt uuu vvv www xxx yyy zzz 0 1 2 3 4 5 6 7 8 9 ! @ # $ % ^ & * ( ) _ + - = { } [ ] : ; ' " < > , . ? / ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值