Thursday, October 28, 2010

Under standing Local Service, Local System and Network Service?

The main difference between these Local Service, Local System and Network Service mainly relay on the security principals. I have website I need to configure remote connections. When we use SQL Server, so when allowing remote connections and you might think which Service account you should use to run SQL Server.

You should use Local non-system or Service account. If this SQL Server service require to access the network resources you can use a ordinary Domain account.

  • Domain User Account
    If the service must interact with network services, access domain resources like file shares or if it uses linked server connections to other computers running SQL Server, you might use a minimally-privileged domain account. Many server-to-server activities can be performed only with a domain user account. This account should be pre-created by domain administration in your environment.
  • Local User Account
    If the computer is not part of a domain, a local user account without Windows administrator permissions is recommended.

Following are NOT advised as it grant more privileges than required for running SQL Server Services

  • Local System is a very high-privileged built-in account. It has extensive privileges on the local system and acts as the computer on the network. The actual name of the account is "NT AUTHORITY\SYSTEM".
  • The Local Service account is a built-in account that has the same level of access to resources and objects as members of the Users group. This limited access helps safeguard the system if individual services or processes are compromised. Services that run as the Local Service account access network resources as a null session without credentials. Be aware that the Local Service account is not supported for the SQL Server or SQL Server Agent services. The actual name of the account is "NT AUTHORITY\LOCAL SERVICE".
  • The Network Service account is a built-in account that has more access to resources and objects than members of the Users group. Services that run as the Network Service account access network resources by using the credentials of the computer account. The actual name of the account is "NT AUTHORITY\NETWORK SERVICE"

Please consider the below recommendations:

  • Always run SQL Server services by using the lowest possible user rights.
  • Use a specific low-privilege user account or domain account instead of a shared account for SQL Server services.
  • Use separate accounts for different SQL Server services.
  • Do not grant additional permissions to the SQL Server service account or the service groups

Saturday, October 16, 2010

Date Formatting in C#

Date formatting in C# using string object

Specifier Description Output
d Short Date 20/10/1983
D Long Date 20 October 1983
t Short Time 21:20
T Long Time 21:20:59
f Full date and time 20 October 1983 21:20
F Full date and time (long) 20 October 1983 21:20:59
g Default date and time 20/10/1983 21:20
G Default date and time (long) 20/10/1983 21:20:59
M Day / Month 20 October
r RFC1123 date Thu, 20 Apr 1983 21:20:59 GMT
s Sortable date/time 1983-10-20T21:20:59
u Universal time, local timezone 1983-10-20 21:20:59Z
Y Month / Year October 1983
dd Day 20
ddd Short Day Name Thu
dddd Full Day Name Thursday
hh 2 digit hour 09
HH 2 digit hour (24 hour) 21
mm 2 digit minute 20
MM Month 10
MMM Short Month name Apr
MMMM Month name October
ss seconds 59
tt AM/PM PM
yy 2 digit year 07
yyyy 4 digit year 1983
: seperator, e.g. {0:hh:mm:ss} 09:20:59
/ seperator, e.g. {0:dd/MM/yyyy} 20/10/1983

Example using the specifier with data object

DateTime now = DateTime.Now;
Console.WriteLine(now.ToString("d"));

Friday, October 15, 2010

Download: SQL Server Sample Databases

SQL Server 2008R2 product sample databases are now available.
SQL Azure sample databases are now available.
SQL Server 2008 product sample databases are still available. If you are having difficulties with the current installer, please refer this Database Installer Help.
SQL Server 2005 product sample databases are still available.

For more help most sample databases and sample database business scenarios are documented on MSDN.

Monday, October 11, 2010

Zoom in/out with Visual Studio 2010

Visual Studio 2010 now supports the ability to zoom in and out of the text editor by using the mouse wheel. Ctrl + Mouse wheel up/down to Zoom in and Out. I love this feature for a couple of reasons:

  • Very nice when showing code to a group, such as during a demo to a large audience, or during team code reviews.
  • Makes it easy to pop in and out of your code to toggle between the “big picture” and “code level” views.

But what if you don’t have a mouse wheel? It turns out that there are keyboard shortcuts for this.

Functionality Command Keyboard Shortcut
Zoom in View.ZoomIn Ctrl+Shift+period
Zoom out View.ZoomOut Ctrl+Shift+comma

Friday, October 08, 2010

Disable User Account Control (UAC) For Administrators Only

If you can’t stand the User Account Control prompts, but you’d still like to retain a little bit of security, you can disable it for Administrator accounts only.

To configure this setting on Windows 7 / Vista Business and Ultimate, you can use the Local Security Policy configuration. Just type in secpol.msc into the Start menu search box and hit enter.

Brose down to Local Policies \ Security Options

image

Find the following in the list: “User Account Control: Behavior of the elevation prompt for administrators in Admin Approval Mode” and double-click on it.

image

Change the setting to “Elevate without prompting”. You should be all done and good to go…

Note: Disabling UAC will lead to a less secure system, so better be warned :-)