Add a public ssh key to the authorized_keys of a user

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have to work on an issue happening on a server running Arch Linux. The other dev sent me an e-mail with the key to access as the root user and wrote me this "You should login as root, upload your public ssh key and add it to the authorized_keys of the xxx user".
He created a user to run a node application. I have the public key file and I need to add it to the authorized_keys of the user he uses to run the app, so I can ssh as this user.
My problem is that I don't know the command to do it. I would like to know how to do it with a file in my local machine or just copy the authorized_keys from the root. Can you help me?
ssh
add a comment |Â
up vote
0
down vote
favorite
I have to work on an issue happening on a server running Arch Linux. The other dev sent me an e-mail with the key to access as the root user and wrote me this "You should login as root, upload your public ssh key and add it to the authorized_keys of the xxx user".
He created a user to run a node application. I have the public key file and I need to add it to the authorized_keys of the user he uses to run the app, so I can ssh as this user.
My problem is that I don't know the command to do it. I would like to know how to do it with a file in my local machine or just copy the authorized_keys from the root. Can you help me?
ssh
Open up~/.ssh/authorized_keysin an editor and append the SSH key there. There are plenty of tutorials around the internet for this kind of thing, please check those out before asking here.
â Jules
Sep 27 at 14:23
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have to work on an issue happening on a server running Arch Linux. The other dev sent me an e-mail with the key to access as the root user and wrote me this "You should login as root, upload your public ssh key and add it to the authorized_keys of the xxx user".
He created a user to run a node application. I have the public key file and I need to add it to the authorized_keys of the user he uses to run the app, so I can ssh as this user.
My problem is that I don't know the command to do it. I would like to know how to do it with a file in my local machine or just copy the authorized_keys from the root. Can you help me?
ssh
I have to work on an issue happening on a server running Arch Linux. The other dev sent me an e-mail with the key to access as the root user and wrote me this "You should login as root, upload your public ssh key and add it to the authorized_keys of the xxx user".
He created a user to run a node application. I have the public key file and I need to add it to the authorized_keys of the user he uses to run the app, so I can ssh as this user.
My problem is that I don't know the command to do it. I would like to know how to do it with a file in my local machine or just copy the authorized_keys from the root. Can you help me?
ssh
ssh
edited Sep 27 at 17:31
jasonwryan
47.6k14131180
47.6k14131180
asked Sep 27 at 14:17
André Luiz
1063
1063
Open up~/.ssh/authorized_keysin an editor and append the SSH key there. There are plenty of tutorials around the internet for this kind of thing, please check those out before asking here.
â Jules
Sep 27 at 14:23
add a comment |Â
Open up~/.ssh/authorized_keysin an editor and append the SSH key there. There are plenty of tutorials around the internet for this kind of thing, please check those out before asking here.
â Jules
Sep 27 at 14:23
Open up
~/.ssh/authorized_keys in an editor and append the SSH key there. There are plenty of tutorials around the internet for this kind of thing, please check those out before asking here.â Jules
Sep 27 at 14:23
Open up
~/.ssh/authorized_keys in an editor and append the SSH key there. There are plenty of tutorials around the internet for this kind of thing, please check those out before asking here.â Jules
Sep 27 at 14:23
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
4
down vote
accepted
Send your key to /tmp then append it to authorized_keys.
Replace SERVER and USER in these commands:
scp ~/.ssh/id_rsa.pub root@SERVER:/tmp/id_andre_luiz
ssh root@SERVER
cat /tmp/id_andre_luiz >> ~USER/.ssh/authorized_keys
Thanks you for the answer!
â André Luiz
Sep 27 at 14:34
add a comment |Â
up vote
1
down vote
I do it like this:
cat <your_public_key_file> >> ~/.ssh/authorized_keys
Note the double > without the double > the existing contents of authorized_keys will be over-written (nuked!) and that may not be desirable.
1
Thank you for the answer!
â André Luiz
Sep 27 at 14:34
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
Send your key to /tmp then append it to authorized_keys.
Replace SERVER and USER in these commands:
scp ~/.ssh/id_rsa.pub root@SERVER:/tmp/id_andre_luiz
ssh root@SERVER
cat /tmp/id_andre_luiz >> ~USER/.ssh/authorized_keys
Thanks you for the answer!
â André Luiz
Sep 27 at 14:34
add a comment |Â
up vote
4
down vote
accepted
Send your key to /tmp then append it to authorized_keys.
Replace SERVER and USER in these commands:
scp ~/.ssh/id_rsa.pub root@SERVER:/tmp/id_andre_luiz
ssh root@SERVER
cat /tmp/id_andre_luiz >> ~USER/.ssh/authorized_keys
Thanks you for the answer!
â André Luiz
Sep 27 at 14:34
add a comment |Â
up vote
4
down vote
accepted
up vote
4
down vote
accepted
Send your key to /tmp then append it to authorized_keys.
Replace SERVER and USER in these commands:
scp ~/.ssh/id_rsa.pub root@SERVER:/tmp/id_andre_luiz
ssh root@SERVER
cat /tmp/id_andre_luiz >> ~USER/.ssh/authorized_keys
Send your key to /tmp then append it to authorized_keys.
Replace SERVER and USER in these commands:
scp ~/.ssh/id_rsa.pub root@SERVER:/tmp/id_andre_luiz
ssh root@SERVER
cat /tmp/id_andre_luiz >> ~USER/.ssh/authorized_keys
edited Sep 27 at 14:41
answered Sep 27 at 14:31
user285259
3407
3407
Thanks you for the answer!
â André Luiz
Sep 27 at 14:34
add a comment |Â
Thanks you for the answer!
â André Luiz
Sep 27 at 14:34
Thanks you for the answer!
â André Luiz
Sep 27 at 14:34
Thanks you for the answer!
â André Luiz
Sep 27 at 14:34
add a comment |Â
up vote
1
down vote
I do it like this:
cat <your_public_key_file> >> ~/.ssh/authorized_keys
Note the double > without the double > the existing contents of authorized_keys will be over-written (nuked!) and that may not be desirable.
1
Thank you for the answer!
â André Luiz
Sep 27 at 14:34
add a comment |Â
up vote
1
down vote
I do it like this:
cat <your_public_key_file> >> ~/.ssh/authorized_keys
Note the double > without the double > the existing contents of authorized_keys will be over-written (nuked!) and that may not be desirable.
1
Thank you for the answer!
â André Luiz
Sep 27 at 14:34
add a comment |Â
up vote
1
down vote
up vote
1
down vote
I do it like this:
cat <your_public_key_file> >> ~/.ssh/authorized_keys
Note the double > without the double > the existing contents of authorized_keys will be over-written (nuked!) and that may not be desirable.
I do it like this:
cat <your_public_key_file> >> ~/.ssh/authorized_keys
Note the double > without the double > the existing contents of authorized_keys will be over-written (nuked!) and that may not be desirable.
edited Sep 27 at 16:17
Rui F Ribeiro
36.9k1273117
36.9k1273117
answered Sep 27 at 14:31
Shervan
1889
1889
1
Thank you for the answer!
â André Luiz
Sep 27 at 14:34
add a comment |Â
1
Thank you for the answer!
â André Luiz
Sep 27 at 14:34
1
1
Thank you for the answer!
â André Luiz
Sep 27 at 14:34
Thank you for the answer!
â André Luiz
Sep 27 at 14:34
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f471837%2fadd-a-public-ssh-key-to-the-authorized-keys-of-a-user%23new-answer', 'question_page');
);
Post as a guest
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
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
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
Open up
~/.ssh/authorized_keysin an editor and append the SSH key there. There are plenty of tutorials around the internet for this kind of thing, please check those out before asking here.â Jules
Sep 27 at 14:23