scp from Raspberry pi to SSH Server, “lost connection”
I am trying to copy a private key from my raspberry pi to an SSH Server (my Android phone, via SimpleSSHD app).
I can successfully ssh in to the server from the Pi with:
ssh 192.168.0.123 -p 2222
But when I do, I have to enter a password that the SimpleSSHD app shows on the (Android) screen
From the doc (linked above), I am trying to add a private key so I don't have to enter a password every time I SSH into the server:
If SimpleSSHD does not find an authorized_keys file when a client connects, then it generates a single-use password at that time and displays it in the console log. So the procedure to login the first time is to initiate the ssh connection, then look at the phone and type in the password that is on the screen in the SimpleSSHD app. It is recommended to use that shell session to install the authorized_keys file.
Once authorized_keys exists, only public key authentication is supported. If you screw up your authorized_keys file, use the options menu (upper right) -> Reset Keys.
The default home directory is now the app-private directory, which will generally be something like /data/data/org.galexander.sshd/files...
So, on my RPi, in a terminal I did:
ssh-keygen
and when I do cat ~/.ssh/id_rsa.pub
, I get this output:
ssh-rsa AAAAB2Naz[long string of random letters/numbers]ASDFG pi@raspberrypi
So I know I have created a private key.
Now, in the RPi terminal, I did:
ssh 192.168.0.123 -p 2222
And entered the password the SimpleSSHD app creates. Then, I created the authorized_keys
folder in the HOME directory, as the docs linked above state...I think:
mkdir ~/authorized_keys
Now, I think all I need to do is copy the RPi's id_rsa.pub
to the SimpleSSHD folder, right?, so I tried this from the RPi terminal:
scp -P 2222 ~/.ssh/id_rsa.pub pi@192.168.0.123:~/authorized_keys/id_rsa.pub
But when I do I get this returned in the RPi Terminal:
id_rsa.pub 0% 0 0.0KB/s --:-- ETAlost connection
What am I doing wrong? I am pretty new to Unix/SSH, so may have missed a step. (I'm also not sure if this is a RPi issue, or Unix/programming issue, so please migrate if needed). I've also made sure I have updated openssh-clients
, as I saw in this Question
Finally, to note, the SimpleSSHD docs say explicitly Create authorized_keys in the home directory (do not use ssh-copy-id)
, so I am not using ssh-copy-id
.
ssh
New contributor
add a comment |
I am trying to copy a private key from my raspberry pi to an SSH Server (my Android phone, via SimpleSSHD app).
I can successfully ssh in to the server from the Pi with:
ssh 192.168.0.123 -p 2222
But when I do, I have to enter a password that the SimpleSSHD app shows on the (Android) screen
From the doc (linked above), I am trying to add a private key so I don't have to enter a password every time I SSH into the server:
If SimpleSSHD does not find an authorized_keys file when a client connects, then it generates a single-use password at that time and displays it in the console log. So the procedure to login the first time is to initiate the ssh connection, then look at the phone and type in the password that is on the screen in the SimpleSSHD app. It is recommended to use that shell session to install the authorized_keys file.
Once authorized_keys exists, only public key authentication is supported. If you screw up your authorized_keys file, use the options menu (upper right) -> Reset Keys.
The default home directory is now the app-private directory, which will generally be something like /data/data/org.galexander.sshd/files...
So, on my RPi, in a terminal I did:
ssh-keygen
and when I do cat ~/.ssh/id_rsa.pub
, I get this output:
ssh-rsa AAAAB2Naz[long string of random letters/numbers]ASDFG pi@raspberrypi
So I know I have created a private key.
Now, in the RPi terminal, I did:
ssh 192.168.0.123 -p 2222
And entered the password the SimpleSSHD app creates. Then, I created the authorized_keys
folder in the HOME directory, as the docs linked above state...I think:
mkdir ~/authorized_keys
Now, I think all I need to do is copy the RPi's id_rsa.pub
to the SimpleSSHD folder, right?, so I tried this from the RPi terminal:
scp -P 2222 ~/.ssh/id_rsa.pub pi@192.168.0.123:~/authorized_keys/id_rsa.pub
But when I do I get this returned in the RPi Terminal:
id_rsa.pub 0% 0 0.0KB/s --:-- ETAlost connection
What am I doing wrong? I am pretty new to Unix/SSH, so may have missed a step. (I'm also not sure if this is a RPi issue, or Unix/programming issue, so please migrate if needed). I've also made sure I have updated openssh-clients
, as I saw in this Question
Finally, to note, the SimpleSSHD docs say explicitly Create authorized_keys in the home directory (do not use ssh-copy-id)
, so I am not using ssh-copy-id
.
ssh
New contributor
I'm guessing here, but perhapsauthorized_keys
should be a file that you create by copying theid_rsa.pub
file. By creating it first (as a directory) perhaps you disabled password-based authentication (as the guide says "Once authorized_keys exists, only public key authentication is supported. If you screw up your authorized_keys file, use the options menu (upper right) -> Reset Keys.")
– steeldriver
3 mins ago
@steeldriver so would I just skip themkdir
part? So should I delete the folder first and just skip toscp ...
?
– BruceWayne
1 min ago
add a comment |
I am trying to copy a private key from my raspberry pi to an SSH Server (my Android phone, via SimpleSSHD app).
I can successfully ssh in to the server from the Pi with:
ssh 192.168.0.123 -p 2222
But when I do, I have to enter a password that the SimpleSSHD app shows on the (Android) screen
From the doc (linked above), I am trying to add a private key so I don't have to enter a password every time I SSH into the server:
If SimpleSSHD does not find an authorized_keys file when a client connects, then it generates a single-use password at that time and displays it in the console log. So the procedure to login the first time is to initiate the ssh connection, then look at the phone and type in the password that is on the screen in the SimpleSSHD app. It is recommended to use that shell session to install the authorized_keys file.
Once authorized_keys exists, only public key authentication is supported. If you screw up your authorized_keys file, use the options menu (upper right) -> Reset Keys.
The default home directory is now the app-private directory, which will generally be something like /data/data/org.galexander.sshd/files...
So, on my RPi, in a terminal I did:
ssh-keygen
and when I do cat ~/.ssh/id_rsa.pub
, I get this output:
ssh-rsa AAAAB2Naz[long string of random letters/numbers]ASDFG pi@raspberrypi
So I know I have created a private key.
Now, in the RPi terminal, I did:
ssh 192.168.0.123 -p 2222
And entered the password the SimpleSSHD app creates. Then, I created the authorized_keys
folder in the HOME directory, as the docs linked above state...I think:
mkdir ~/authorized_keys
Now, I think all I need to do is copy the RPi's id_rsa.pub
to the SimpleSSHD folder, right?, so I tried this from the RPi terminal:
scp -P 2222 ~/.ssh/id_rsa.pub pi@192.168.0.123:~/authorized_keys/id_rsa.pub
But when I do I get this returned in the RPi Terminal:
id_rsa.pub 0% 0 0.0KB/s --:-- ETAlost connection
What am I doing wrong? I am pretty new to Unix/SSH, so may have missed a step. (I'm also not sure if this is a RPi issue, or Unix/programming issue, so please migrate if needed). I've also made sure I have updated openssh-clients
, as I saw in this Question
Finally, to note, the SimpleSSHD docs say explicitly Create authorized_keys in the home directory (do not use ssh-copy-id)
, so I am not using ssh-copy-id
.
ssh
New contributor
I am trying to copy a private key from my raspberry pi to an SSH Server (my Android phone, via SimpleSSHD app).
I can successfully ssh in to the server from the Pi with:
ssh 192.168.0.123 -p 2222
But when I do, I have to enter a password that the SimpleSSHD app shows on the (Android) screen
From the doc (linked above), I am trying to add a private key so I don't have to enter a password every time I SSH into the server:
If SimpleSSHD does not find an authorized_keys file when a client connects, then it generates a single-use password at that time and displays it in the console log. So the procedure to login the first time is to initiate the ssh connection, then look at the phone and type in the password that is on the screen in the SimpleSSHD app. It is recommended to use that shell session to install the authorized_keys file.
Once authorized_keys exists, only public key authentication is supported. If you screw up your authorized_keys file, use the options menu (upper right) -> Reset Keys.
The default home directory is now the app-private directory, which will generally be something like /data/data/org.galexander.sshd/files...
So, on my RPi, in a terminal I did:
ssh-keygen
and when I do cat ~/.ssh/id_rsa.pub
, I get this output:
ssh-rsa AAAAB2Naz[long string of random letters/numbers]ASDFG pi@raspberrypi
So I know I have created a private key.
Now, in the RPi terminal, I did:
ssh 192.168.0.123 -p 2222
And entered the password the SimpleSSHD app creates. Then, I created the authorized_keys
folder in the HOME directory, as the docs linked above state...I think:
mkdir ~/authorized_keys
Now, I think all I need to do is copy the RPi's id_rsa.pub
to the SimpleSSHD folder, right?, so I tried this from the RPi terminal:
scp -P 2222 ~/.ssh/id_rsa.pub pi@192.168.0.123:~/authorized_keys/id_rsa.pub
But when I do I get this returned in the RPi Terminal:
id_rsa.pub 0% 0 0.0KB/s --:-- ETAlost connection
What am I doing wrong? I am pretty new to Unix/SSH, so may have missed a step. (I'm also not sure if this is a RPi issue, or Unix/programming issue, so please migrate if needed). I've also made sure I have updated openssh-clients
, as I saw in this Question
Finally, to note, the SimpleSSHD docs say explicitly Create authorized_keys in the home directory (do not use ssh-copy-id)
, so I am not using ssh-copy-id
.
ssh
ssh
New contributor
New contributor
New contributor
asked 13 mins ago
BruceWayneBruceWayne
1033
1033
New contributor
New contributor
I'm guessing here, but perhapsauthorized_keys
should be a file that you create by copying theid_rsa.pub
file. By creating it first (as a directory) perhaps you disabled password-based authentication (as the guide says "Once authorized_keys exists, only public key authentication is supported. If you screw up your authorized_keys file, use the options menu (upper right) -> Reset Keys.")
– steeldriver
3 mins ago
@steeldriver so would I just skip themkdir
part? So should I delete the folder first and just skip toscp ...
?
– BruceWayne
1 min ago
add a comment |
I'm guessing here, but perhapsauthorized_keys
should be a file that you create by copying theid_rsa.pub
file. By creating it first (as a directory) perhaps you disabled password-based authentication (as the guide says "Once authorized_keys exists, only public key authentication is supported. If you screw up your authorized_keys file, use the options menu (upper right) -> Reset Keys.")
– steeldriver
3 mins ago
@steeldriver so would I just skip themkdir
part? So should I delete the folder first and just skip toscp ...
?
– BruceWayne
1 min ago
I'm guessing here, but perhaps
authorized_keys
should be a file that you create by copying the id_rsa.pub
file. By creating it first (as a directory) perhaps you disabled password-based authentication (as the guide says "Once authorized_keys exists, only public key authentication is supported. If you screw up your authorized_keys file, use the options menu (upper right) -> Reset Keys.")– steeldriver
3 mins ago
I'm guessing here, but perhaps
authorized_keys
should be a file that you create by copying the id_rsa.pub
file. By creating it first (as a directory) perhaps you disabled password-based authentication (as the guide says "Once authorized_keys exists, only public key authentication is supported. If you screw up your authorized_keys file, use the options menu (upper right) -> Reset Keys.")– steeldriver
3 mins ago
@steeldriver so would I just skip the
mkdir
part? So should I delete the folder first and just skip to scp ...
?– BruceWayne
1 min ago
@steeldriver so would I just skip the
mkdir
part? So should I delete the folder first and just skip to scp ...
?– BruceWayne
1 min ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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
});
}
});
BruceWayne is a new contributor. Be nice, and check out our Code of Conduct.
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%2funix.stackexchange.com%2fquestions%2f505995%2fscp-from-raspberry-pi-to-ssh-server-lost-connection%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
BruceWayne is a new contributor. Be nice, and check out our Code of Conduct.
BruceWayne is a new contributor. Be nice, and check out our Code of Conduct.
BruceWayne is a new contributor. Be nice, and check out our Code of Conduct.
BruceWayne is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- 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%2funix.stackexchange.com%2fquestions%2f505995%2fscp-from-raspberry-pi-to-ssh-server-lost-connection%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
I'm guessing here, but perhaps
authorized_keys
should be a file that you create by copying theid_rsa.pub
file. By creating it first (as a directory) perhaps you disabled password-based authentication (as the guide says "Once authorized_keys exists, only public key authentication is supported. If you screw up your authorized_keys file, use the options menu (upper right) -> Reset Keys.")– steeldriver
3 mins ago
@steeldriver so would I just skip the
mkdir
part? So should I delete the folder first and just skip toscp ...
?– BruceWayne
1 min ago