pentaho/pentaho-kettle · error · JSchException
Could not get user name on remote host (error code: )
Error message
Could not get user name on remote host (error code: )
What it means
Thrown by SftpFileSystemWindows.getUser() when the remote 'whoami' command (WHO_AMI) exits with a non-zero code, so the remote user name cannot be determined. The user name is required to populate group/identity info on Windows SFTP connections.
Solutions
- Manually run 'whoami' over SSH as the same account to reproduce and see the exit code
- Verify the SSH server provides a Windows command shell (WinClass execution) and whoami.exe is on PATH
- Unblock whoami.exe via security policy or antivirus exclusions
- Use an account whose shell can execute whoami
- Catch the JSchException and fall back to the username supplied in the VFS connection URI
Example fix
// before
String user = fs.getUser();
// after
String user;
try {
user = fs.getUser();
} catch ( JSchException | IOException e ) {
user = rootName.getUserName(); // fallback to configured username
} Defensive patterns
Strategy: try-catch
Validate before calling
// ssh user@host "whoami" || echo WILL_FAIL
Try / catch
try {
String user = fs.getUser();
} catch ( JSchException | IOException e ) {
// fall back to the username from the connection URI
} Prevention
- Confirm 'whoami' works over plain SSH with the same credentials
- Use accounts whose shells are not restricted
- Keep the Windows OpenSSH server default shell as cmd.exe or ensure WinClass execution works
- Cache the username once resolved to avoid repeated remote calls
When it happens
Trigger: Any call chain that resolves the remote user (getUser, and therefore getUserGroups/userGroups) when 'whoami' returns non-zero on the remote Windows host.
Common situations: Same causes as the groups error: restricted remote shell, whoami.exe blocked or missing from PATH, non-Windows-class SSH server, account lacking execute rights.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- Could not get the groups of the current user (error code: )
- FileSystemConfigBuilder could not parse parameter:
- SFTPPut.Error.CanNotFindField
- SFTPPut.Error.CanNotFindFolder
- vfs.provider.sftp/connect.error
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/73fc708230d4800f.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/vfs/SftpFileSystemWindows.java:151
if ( endIndex < 0 ) {
return result;
}
result.add( commandOutput.substring( startIndex, endIndex ).toUpperCase().trim() );
}
}
/**
* Get current user on remote host
*
* @return name of user on remote host
* @throws JSchException
* @throws IOException
*/
String getUser() throws JSchException, IOException {
StringBuilder output = new StringBuilder();
int code = this.executeCommandWinClass( WHO_AMI, output );
if ( code != 0 ) {
throw new JSchException( "Could not get user name on remote host (error code: " + code + ")" );
}
return output.toString().trim().toUpperCase();
}
/**
* @param path path to file or directory
* @return Map Windows Group - permissions
* @throws JSchException
* @throws IOException
*/
Map<String, String> getFilePermission( String path ) throws JSchException, IOException {
String windowsAbsPath;
if ( path.startsWith( WINDOWS_PATH_DELIMITER ) ) {
//cut first "/" windows does not have it
//it mean first letter is name of disk
path = path.substring( WINDOWS_PATH_DELIMITER.length() );
windowsAbsPath = path.substring( 0, 1 ) + ":" + path.substring( 1 );View on GitHub (pinned to f3058517a1)