Get-SCXSSHCredential

Creates a privileged credential, by using the Secure Shell (SSH) protocol, for management operations on UNIX and Linux computers.

Syntax

Get-SCXSSHCredential
   [-UserName] <String>
   [-SSHKey <String>]
   [-ElevationType <String>]
   [-SuppressWarning]
   [<CommonParameters>]

Description

The Get-SCXSSHCredential cmdlet creates a credential for use in privileged UNIX or Linux SSH agent management operations.

Examples

Example 1: Create privileged credential

PS C:\>Get-SCXSSHCredential -UserName "root"
Password:  *************

This command creates a privileged SSH credential with a user name and prompts for a password.

Example 2: Create privileged credential with su type

PS C:\>Get-SCXSSHCredential -UserName "DavidChew" -ElevationType su
Password:  *************
Su Password: *************

This command creates a low-privileged credential with a user name and su elevation type. It then prompts for a password for the low-privileged account and the su password for the elevation.

Example 3: Create privileged credential with sudo type

PS C:\>Get-SCXSSHCredential -UserName "DavidChew" -ElevationType sudo
Password: *************

This command creates a credential with a low-privileged account with a user name and a sudo elevation type. It then prompts for a password for the low-privileged account.

Example 4: Create privileged credential with passphrase

PS C:\>Get-SCXSSHCredential -UserName "root" -SSHKey "C:\keys\admin.ppk" 
Key Passphrase: *************

This command creates a privileged credential with a user name and an SSH key. It then prompts for a passphrase. If a passphrase was not configured with the SSH key, just press Enter.

Example 5: Create privileged credential with su and passphrase

PS C:\>Get-SCXSSHCredential -UserName "DavidChew" -SSHKey "C:\keys\DavidChew.ppk" -ElevationType su 
Su Password: *************
Key Passphrase:

This command creates a low-privileged credential with a user name, an SSH key, and a su elevation type. It then prompts for the su password and a key passphrase.

Example 6: Create privileged credential with sudo and passphrase

C:\PS>Get-SCXSSHCredential -UserName "DavidChew" -SSHKey "C:\keys\DavidChew.ppk" -ElevationType sudo
Key Passphrase:

This command creates a low-privileged credential with a user name, an SSH key, and a sudo elevation type. It then prompts for a key passphrase.

Parameters

-ElevationType

Specifies the elevation method, either su or sudo, that elevates the supplied credential to a privileged account on the UNIX or Linux computer. If left unspecified, the cmdlet treats the credential that is used to create the SSH connection as privileged. If ElevationType is su, a root password must be provided for the SuPassword parameter.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SSHKey

Specifies the file name, including its path, of an SSH key. The SSH key file must be in PuTTY key format. This parameter is required unless a password is specified.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SuppressWarning

Indicates that this cmdlet suppresses warnings.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-UserName

Specifies the user name for an SSH connection.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

Outputs

Microsoft.Unix.SSHCredential

This cmdlet returns the SSHCredential object as output.