IT Questions and Answers :)

Tuesday, February 25, 2020

When called without an argument, which of the following returns the SQL Server login of the current security context.

When called without an argument, which of the following returns the SQL Server login of the current security context.

  • ORIGINAL_LOGIN()
  • SUSER_SNAME()
  • USER_NAME()
  • SUSER_SID()
When called without an argument, which of the following returns the SQL Server login of the current security context.

EXPLANATION

SUSER_SNAME() - returns the login of the current security context.

ORIGINAL_LOGIN() - returns login of original connection context. It is not affected by context-switching.

USER_NAME() - returns the database user name of the current security context.

SUSER_SID() - Returns the Security Identifier (SID) of the current security context.

SQL Server has system-level logins and database users. While they often have the same username, they are distinct from one another. Logins are needed to gain access and set system-level permissions to SQL Server, while Users are needed for access and permissions to specific databases.

The current security context in SQL Server can be changed, known as context-switching or impersonation, with the use of the EXECUTE AS and REVERT statements in a script or batch.

Additional reading:
SQL Server Security Principals - https://docs.microsoft.com/en-us/sql/relational-databases/security/authentication-access/principals-database-engine?view=sql-server-2017
Context-switching - https://sqlity.net/en/1783/changing-security-context-execute-revert/

SOURCE

https://docs.microsoft.com/en-us/sql/t-sql/functions/security-functions-transact-sql?view=sql-server-2017
Share:

In PowerShell, a built-in method of performing iteration is foreach. You can also use foreach later in the pipeline (e.g. Get-Process | foreach {...}). When it appears in the pipeline like this, which of the following is foreach?

In PowerShell, a built-in method of performing iteration is foreach. You can also use foreach later in the pipeline (e.g. Get-Process | foreach {...}). When it appears in the pipeline like this, which of the following is foreach?

  • An alias
  • A cmdlet
  • A method
  • A function 

 
In PowerShell, a built-in method of performing iteration is foreach. You can also use foreach later in the pipeline (e.g. Get-Process | foreach {...}). When it appears in the pipeline like this, which of the following is foreach?

EXPLANATION

When called at the beginning of the line, foreach is a language command built in to PowerShell that allows you to iterate though items in a collection.  When it appears later in the pipeline, however, such as with the example above, it behaves differently in a few very important ways, such as how it works with the collection.
This is because the language command "foreach" only works at the beginning of the pipeline; anywhere else, and you are actually using the built in alias "foreach" which is defined as the cmdlet "ForEach-Object".
about_Foreach on MSDN: https://msdn.microsoft.com/en-us/powershell/reference/4.0/microsoft.powershell.core/about/about_fore...
ForEach-Object on MSDN: https://msdn.microsoft.com/powershell/reference/4.0/microsoft.powershell.core/ForEach-Object
Share:

Saturday, February 22, 2020

Which of the following are based on public key cryptography?

Which of the following are based on public key cryptography?

  • Hybrid keys
  • Key escrow
  • Digital signatures
  • Diffusion 
Which of the following are based on public key cryptography?

EXPLANATION

Public-key cryptography, or asymmetric cryptography, is a cryptographic system that uses pairs of keys: public keys which may be disseminated widely, and private keys which are known only to the owner. The generation of such keys depends on cryptographic algorithms based on mathematical problems to produce one-way functions. Effective security only requires keeping the private key private; the public key can be openly distributed without compromising security.[1]
In such a system, any person can encrypt a message using the receiver's public key, but that encrypted message can only be decrypted with the receiver's private key.
Robust authentication is also possible. A sender can combine a message with a private key to create a short digital signature on the message. Anyone with the sender's corresponding public key can combine the same message and the supposed digital signature associated with it to verify whether the signature was valid, i.e. made by the owner of the corresponding private key.[2][3]
Public key algorithms are fundamental security ingredients in modern cryptosystems, applications and protocols assuring the confidentiality, authenticity and non-repudiability of electronic communications and data storage. They underpin various Internet standards, such as Transport Layer Security (TLS), S/MIME, PGP, and GPG. Some public key algorithms provide key distribution and secrecy (e.g., Diffie–Hellman key exchange), some provide digital signatures (e.g., Digital Signature Algorithm), and some provide both (e.g., RSA).


Share:

What was the first configuration file to be parsed by MS-DOS during a boot up operation?

What was the first configuration file to be parsed by MS-DOS during a boot up operation?

  • CONFIG.SYS
  • STARTUP.CMD
  • MSDOS.SYS
  • AUTOEXEC.BAT 

EXPLANATION

AUTOEXEC.BAT is a system file that was originally on DOS-type operating systems. It is a plain-text batch file in the root directory of the boot device. The name of the file is an abbreviation of "automatic execution", which describes its function in automatically executing commands on system startup; the filename was coined in response to the 8.3 filename limitations of the FAT file system family.  

AUTOEXEC.BAT is read upon startup by all versions of DOS, including MS-DOS version 7.x as used in Windows 95 and Windows 98. Windows ME only parses environment variables as part of its attempts to reduce legacy dependencies,[1] but this can be worked around.[2]
The filename was also used by Disk Control Program [de] (DCP), an MS-DOS derivative by the former East-German VEB Robotron.[3]
In Korean versions of MS-DOS/PC DOS 4.01 and higher (except for PC DOS 7 and 2000), if the current country code is set to 82 (for Korea) and no /P:filename is given and no default AUTOEXEC.BAT is found, COMMAND.COM will look for a file named KAUTOEXE.BAT instead in order to ensure that the DBCS frontend drivers will be loaded even without properly set up CONFIG.SYS and AUTOEXEC.BAT files.[4]
Under DOS, the file is executed by the primary copy of the command-line processor (typically COMMAND.COM) once the operating system has booted and the CONFIG.SYS file processing has finished. While DOS by itself provides no means to pass batch file parameters to COMMAND.COM for AUTOEXEC.BAT processing, the alternative command-line processor 4DOS supports a 4DOS.INI AutoExecParams directive and //AutoExecParams= startup option to define such parameters.[5] Under Concurrent DOS, Multiuser DOS and REAL/32, three initial parameters will be passed to either the corresponding STARTxxy.BAT (if it exists) or the generic AUTOEXEC.BAT startup file, %1 holds the virtual console number,[6] %2 the 2-digit terminal number (xx) (with 00 being the main console) and %3 the 1-digit session number (y).[7]
Windows NT and its descendants Windows XP and Windows Vista parse AUTOEXEC.BAT when a user logs on. As with Windows ME, anything other than setting environment variables is ignored.[8] Unlike CONFIG.SYS, the commands in AUTOEXEC.BAT can be entered at the interactive command line interpreter. They are just standard commands that the computer operator wants to be executed automatically whenever the computer is started, and can include other batch files.
AUTOEXEC.BAT is most often used to set environment variables such as keyboard, soundcard, printer, and temporary file locations. It is also used to initiate low level system utilities, such as the following:
  • Virus scanners
  • Disk caching software
  • Mouse drivers
  • Keyboard drivers
  • CD drivers
  • Miscellaneous other drivers

 


Share:

Which MS-DOS command allows you to shut down a user remotely?

Which MS-DOS command allows you to shut down a user remotely?

  • shutdown -i
  • @echo on shutdown -i -s
  • shutdown -s
  • shutdown -s -t 
Which MS-DOS command allows you to shut down a user remotely?

EXPLANATION

Enables you to shut down or restart local or remote computers one at a time.
For examples of how to use this command, see Examples.

Syntax

shutdown [/i | /l | /s | /r | /a | /p | /h | /e] [/f] [/m \\<ComputerName>] [/t <XXX>] [/d [p|u:]<XX>:<YY> [/c "comment"]] 

Parameters

Parameter Description
/i Displays the Remote Shutdown Dialog box. The /i option must be the first parameter following the command. If /i is specified, all other options are ignored.
/l Logs off the current user immediately, with no time-out period. You cannot use /l with /m or /t.
/s Shuts down the computer.
/r Restarts the computer after shutdown.
/a Aborts a system shutdown. Effective only during the timeout period. To use /a, you must also use the /m option.
/p Turns off the local computer only (not a remote computer)—with no time-out period or warning. You can use /p only with /d or /f. If your computer does not support power-off functionality, it will shut down when you use /p, but the power to the computer will remain on.
/h Puts the local computer into hibernation, if hibernation is enabled. You can use /h only with /f.
/e Enables you to document the reason for the unexpected shutdown on the target computer.
/f Forces running applications to close without warning users.
Caution: Using the /f option might result in loss of unsaved data.
/m \\<ComputerName> Specifies the target computer. Cannot be used with the /l option.
/t <XXX> Sets the time-out period or delay to XXX seconds before a restart or shutdown. This causes a warning to display on the local console. You can specify 0-600 seconds. If you do not use /t, the time-out period is 30 seconds by default.
/d [p|u:]<XX>:<YY> Lists the reason for the system restart or shutdown. The following are the parameter values:
p Indicates that the restart or shutdown is planned.
u Indicates that the reason is user defined.
Note: If p or u are not specified, the restart or shutdown is unplanned.
XX Specifies the major reason number (positive integer less than 256).
YY Specifies the minor reason number (positive integer less than 65536).
/c "<Comment>" Enables you to comment in detail about the reason for the shutdown. You must first provide a reason by using the /d option. You must enclose comments in quotation marks. You can use a maximum of 511 characters.
/? Displays help at the command prompt, including a list of the major and minor reasons that are defined on your local computer.


Share:

Popular Posts