ssh: Advise use of 'balena login' if root authentication fails

Change-type: patch
This commit is contained in:
Paulo Castro 2022-02-24 16:13:47 +00:00
parent 7e4f4392e9
commit cd17d79067

View File

@ -299,7 +299,13 @@ export const findBestUsernameForDevice = _.memoize(
const { getCachedUsername } = await import('./bootstrap');
username = (await getCachedUsername())?.username;
}
return username || 'root';
if (!username) {
const { stripIndent } = await import('./lazy');
throw new ExpectedError(stripIndent`
SSH authentication failed for 'root@${hostname}'.
Please login with 'balena login' for alternative authentication.`);
}
return username;
},
);