Default SSH username doesn't match $USER value in macOS
Note: I managed to get this working, now I'm trying to figure out why there's a discrepancy.
I recently enabled remote access on my laptop running macOS High Sierra. However, I initially had trouble ssh-ing in. When I ran ssh localhost
it would prompt me for a password which it always rejected. When I ran ssh ${USER}@localhost
my SSH keys kicked in and I logged in immediately.
After turning up the verbosity, I noticed that ssh localhost
was attempting to authenticate as firstname.lastname
, but my user account and $USER
variable are firstnamelastname
(without a dot). This explains why ssh ${USER}@localhost
worked and the other didn't.
So what gives? Why is ssh trying to authenticate with something other than $USER
? Where is it getting the dotted form from?
macos ssh macos-highsierra
add a comment |
Note: I managed to get this working, now I'm trying to figure out why there's a discrepancy.
I recently enabled remote access on my laptop running macOS High Sierra. However, I initially had trouble ssh-ing in. When I ran ssh localhost
it would prompt me for a password which it always rejected. When I ran ssh ${USER}@localhost
my SSH keys kicked in and I logged in immediately.
After turning up the verbosity, I noticed that ssh localhost
was attempting to authenticate as firstname.lastname
, but my user account and $USER
variable are firstnamelastname
(without a dot). This explains why ssh ${USER}@localhost
worked and the other didn't.
So what gives? Why is ssh trying to authenticate with something other than $USER
? Where is it getting the dotted form from?
macos ssh macos-highsierra
add a comment |
Note: I managed to get this working, now I'm trying to figure out why there's a discrepancy.
I recently enabled remote access on my laptop running macOS High Sierra. However, I initially had trouble ssh-ing in. When I ran ssh localhost
it would prompt me for a password which it always rejected. When I ran ssh ${USER}@localhost
my SSH keys kicked in and I logged in immediately.
After turning up the verbosity, I noticed that ssh localhost
was attempting to authenticate as firstname.lastname
, but my user account and $USER
variable are firstnamelastname
(without a dot). This explains why ssh ${USER}@localhost
worked and the other didn't.
So what gives? Why is ssh trying to authenticate with something other than $USER
? Where is it getting the dotted form from?
macos ssh macos-highsierra
Note: I managed to get this working, now I'm trying to figure out why there's a discrepancy.
I recently enabled remote access on my laptop running macOS High Sierra. However, I initially had trouble ssh-ing in. When I ran ssh localhost
it would prompt me for a password which it always rejected. When I ran ssh ${USER}@localhost
my SSH keys kicked in and I logged in immediately.
After turning up the verbosity, I noticed that ssh localhost
was attempting to authenticate as firstname.lastname
, but my user account and $USER
variable are firstnamelastname
(without a dot). This explains why ssh ${USER}@localhost
worked and the other didn't.
So what gives? Why is ssh trying to authenticate with something other than $USER
? Where is it getting the dotted form from?
macos ssh macos-highsierra
macos ssh macos-highsierra
edited Jan 22 at 21:33
JakeGould
31.6k1097139
31.6k1097139
asked Jan 22 at 21:20
Mr. LlamaMr. Llama
17311
17311
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
If ssh localhost
is using a different username from the one in $USER
there might be a line overriding the User in your ssh configuration file.
Check in ~/.ssh/config
and /etc/ssh/ssh_config
You can also try to add the following line in your ~/.ssh/config
(create the file if it doesn't exists):
User firstnamelastname
Then, restart ssh
:
sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
and check again your ssh default user name with verbose mode:
ssh -v localhost
You should see a line like this:
debug1: Authenticating to localhost:22 as 'firstnamelastname'
(That is, the one you defined in your ~/.ssh/config
)
Bah, silly me. That's exactly what it was. Not sure what past me was thinking when I put it there.
– Mr. Llama
Jan 23 at 17:54
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1397177%2fdefault-ssh-username-doesnt-match-user-value-in-macos%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If ssh localhost
is using a different username from the one in $USER
there might be a line overriding the User in your ssh configuration file.
Check in ~/.ssh/config
and /etc/ssh/ssh_config
You can also try to add the following line in your ~/.ssh/config
(create the file if it doesn't exists):
User firstnamelastname
Then, restart ssh
:
sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
and check again your ssh default user name with verbose mode:
ssh -v localhost
You should see a line like this:
debug1: Authenticating to localhost:22 as 'firstnamelastname'
(That is, the one you defined in your ~/.ssh/config
)
Bah, silly me. That's exactly what it was. Not sure what past me was thinking when I put it there.
– Mr. Llama
Jan 23 at 17:54
add a comment |
If ssh localhost
is using a different username from the one in $USER
there might be a line overriding the User in your ssh configuration file.
Check in ~/.ssh/config
and /etc/ssh/ssh_config
You can also try to add the following line in your ~/.ssh/config
(create the file if it doesn't exists):
User firstnamelastname
Then, restart ssh
:
sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
and check again your ssh default user name with verbose mode:
ssh -v localhost
You should see a line like this:
debug1: Authenticating to localhost:22 as 'firstnamelastname'
(That is, the one you defined in your ~/.ssh/config
)
Bah, silly me. That's exactly what it was. Not sure what past me was thinking when I put it there.
– Mr. Llama
Jan 23 at 17:54
add a comment |
If ssh localhost
is using a different username from the one in $USER
there might be a line overriding the User in your ssh configuration file.
Check in ~/.ssh/config
and /etc/ssh/ssh_config
You can also try to add the following line in your ~/.ssh/config
(create the file if it doesn't exists):
User firstnamelastname
Then, restart ssh
:
sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
and check again your ssh default user name with verbose mode:
ssh -v localhost
You should see a line like this:
debug1: Authenticating to localhost:22 as 'firstnamelastname'
(That is, the one you defined in your ~/.ssh/config
)
If ssh localhost
is using a different username from the one in $USER
there might be a line overriding the User in your ssh configuration file.
Check in ~/.ssh/config
and /etc/ssh/ssh_config
You can also try to add the following line in your ~/.ssh/config
(create the file if it doesn't exists):
User firstnamelastname
Then, restart ssh
:
sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
and check again your ssh default user name with verbose mode:
ssh -v localhost
You should see a line like this:
debug1: Authenticating to localhost:22 as 'firstnamelastname'
(That is, the one you defined in your ~/.ssh/config
)
answered Jan 23 at 0:24
YoricYoric
3196
3196
Bah, silly me. That's exactly what it was. Not sure what past me was thinking when I put it there.
– Mr. Llama
Jan 23 at 17:54
add a comment |
Bah, silly me. That's exactly what it was. Not sure what past me was thinking when I put it there.
– Mr. Llama
Jan 23 at 17:54
Bah, silly me. That's exactly what it was. Not sure what past me was thinking when I put it there.
– Mr. Llama
Jan 23 at 17:54
Bah, silly me. That's exactly what it was. Not sure what past me was thinking when I put it there.
– Mr. Llama
Jan 23 at 17:54
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1397177%2fdefault-ssh-username-doesnt-match-user-value-in-macos%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown