Minimum SQL permissions to read

  • I have an application that runs a script against our company database. I was curious what was the minimum permissions I could give the sql user. The only thing the script does runs a query against 4 tables.

    Thanks

  • Login to the server. Access to the database with Select only on those 4 tables.

  • the datareader role should grant select on tables.

    of course you could modify the public role but i wouldnt recommend that

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Perry Whittle (7/22/2008)


    the datareader role should grant select on tables.

    of course you could modify the public role but i wouldnt recommend that

    This would work but provides more

    than the minimum rights, assuming there are

    more than 4 tables in the db.

  • datareader only applies to user tables so should be safe

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Perry Whittle (7/22/2008)


    datareader only applies to user tables so should be safe

    Sure, but it applies to ALL user tables in the database. Using the datareader role is usually a mistake as it does not apply the least permissions needed. If there are 6 tables like this:

    Employees

    EmployeeAddresses

    EmployeeSalaries

    EmployeeSkills

    Skills

    EmployeeDiscipline

    Assigning a user to the datareader role grants rights to all the tables and only HR should have rights to salaries and discipline, so if the application only requires rights to Employees and EmployeeAddresses in order create a mailing list then that's all the role\user should have select rights on.

  • Jack Corbett (7/22/2008)


    Perry Whittle (7/22/2008)


    datareader only applies to user tables so should be safe

    Sure, but it applies to ALL user tables in the database. Using the datareader role is usually a mistake as it does not apply the least permissions needed. If there are 6 tables like this:

    Employees

    EmployeeAddresses

    EmployeeSalaries

    EmployeeSkills

    Skills

    EmployeeDiscipline

    Assigning a user to the datareader role grants rights to all the tables and only HR should have rights to salaries and discipline, so if the application only requires rights to Employees and EmployeeAddresses in order create a mailing list then that's all the role\user should have select rights on.

    in that case i would explicitly deny select on those few tables to the appropriate users\groups and the users would still have read to all other tables

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply