nxc Verified current stable Not installed? Security

Nxc / Use Private Key For Authentication

Use Private Key For Authentication

Authenticate to a remote host using SSH with a private key.

$
Terminal
nxc ssh <192.186.178.2> -u <path/to/usernames.txt> -p <password> --key-file <path/to/id_rsa>

When To Use

During a security audit requiring SSH access to a known IP with a valid key.

Pro Tip

Check if `sshd` allows public key authentication; if not, login may fail even with a valid key.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
nxc ssh <192.186.178.2> -u <path/to/usernames.txt> -p <password> --key-file <path/to/id_rsa>

Anatomy of Output

Understanding the result

Welcome to Ubuntu 20.04 LTS OS Version

Indicates the version of the operating system.

Last login: Fri Oct 13 10:03:06 2023 from 192.186.178.1 Login Timestamp & IP

The last successful login details.

# whoami Current User

Command verifying the logged-in user (the effective user after authentication).

Troubleshooting

Common pitfalls

ssh: Could not resolve hostname 192.186.178.2: Name or service not known

Solution: Verify the IP address format.

Permission denied (publickey).

Solution: Ensure the correct private key is specified and has proper permissions.

ssh: connect to host 192.186.178.2 port 22: Connection timed out

Solution: Check the network connectivity and firewall settings on the target.

Command Breakdown

What each part is doing

nxc
Base Command
The executable that performs this operation. Here it runs Nxc before the shell applies any redirect operators.
<192.186.178.2>
192.186.178.2
The value supplied for 192.186.178.2.
-u
u| username
The user value supplied to this command.
<path/to/usernames.txt>
path to usernames.txt
The user value supplied to this command.
-p
p| password
The value supplied for p| password.
<password>
password
The value supplied for password.
<path/to/id_rsa>
path to id rsa
The value supplied for path to id rsa.
-u
Command Option
Tool-specific option used by this command invocation.
-p
Command Option
Tool-specific option used by this command invocation.
--key-file
Command Option
Tool-specific option used by this command invocation.

Alternative Approaches

Comparable commands in other tools

Alternative security tools for the same job.