bash: /home/user/.ssh/authorized_keys: No such file or directory
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
16
down vote
favorite
Create a ssh key:
Command:
ssh-keygen -t rsa âÂÂP ""
Moving the key to authorized key:
Command:
cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
bash: /home/user/.ssh/authorized_keys: No such file or directory
command-line ssh
add a comment |Â
up vote
16
down vote
favorite
Create a ssh key:
Command:
ssh-keygen -t rsa âÂÂP ""
Moving the key to authorized key:
Command:
cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
bash: /home/user/.ssh/authorized_keys: No such file or directory
command-line ssh
1
~/.ssh/authorized_keys
are keys of other computers that you connected to/trust, not your own key.
â saiarcot895
May 15 '14 at 19:58
Some applications require passwordless ssh to one's own machine.
â Nehal J Wani
May 15 '14 at 20:03
Please don't post the same question on multiple sites of the Stack Exchange network.
â terdonâ¦
May 16 '14 at 0:43
Why you need to trust the key you own? Exactly what are you trying to do?
â Braiam
May 16 '14 at 1:27
add a comment |Â
up vote
16
down vote
favorite
up vote
16
down vote
favorite
Create a ssh key:
Command:
ssh-keygen -t rsa âÂÂP ""
Moving the key to authorized key:
Command:
cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
bash: /home/user/.ssh/authorized_keys: No such file or directory
command-line ssh
Create a ssh key:
Command:
ssh-keygen -t rsa âÂÂP ""
Moving the key to authorized key:
Command:
cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
bash: /home/user/.ssh/authorized_keys: No such file or directory
command-line ssh
command-line ssh
edited May 16 '14 at 1:25
Braiam
50k20131214
50k20131214
asked May 15 '14 at 19:50
user282060
81113
81113
1
~/.ssh/authorized_keys
are keys of other computers that you connected to/trust, not your own key.
â saiarcot895
May 15 '14 at 19:58
Some applications require passwordless ssh to one's own machine.
â Nehal J Wani
May 15 '14 at 20:03
Please don't post the same question on multiple sites of the Stack Exchange network.
â terdonâ¦
May 16 '14 at 0:43
Why you need to trust the key you own? Exactly what are you trying to do?
â Braiam
May 16 '14 at 1:27
add a comment |Â
1
~/.ssh/authorized_keys
are keys of other computers that you connected to/trust, not your own key.
â saiarcot895
May 15 '14 at 19:58
Some applications require passwordless ssh to one's own machine.
â Nehal J Wani
May 15 '14 at 20:03
Please don't post the same question on multiple sites of the Stack Exchange network.
â terdonâ¦
May 16 '14 at 0:43
Why you need to trust the key you own? Exactly what are you trying to do?
â Braiam
May 16 '14 at 1:27
1
1
~/.ssh/authorized_keys
are keys of other computers that you connected to/trust, not your own key.â saiarcot895
May 15 '14 at 19:58
~/.ssh/authorized_keys
are keys of other computers that you connected to/trust, not your own key.â saiarcot895
May 15 '14 at 19:58
Some applications require passwordless ssh to one's own machine.
â Nehal J Wani
May 15 '14 at 20:03
Some applications require passwordless ssh to one's own machine.
â Nehal J Wani
May 15 '14 at 20:03
Please don't post the same question on multiple sites of the Stack Exchange network.
â terdonâ¦
May 16 '14 at 0:43
Please don't post the same question on multiple sites of the Stack Exchange network.
â terdonâ¦
May 16 '14 at 0:43
Why you need to trust the key you own? Exactly what are you trying to do?
â Braiam
May 16 '14 at 1:27
Why you need to trust the key you own? Exactly what are you trying to do?
â Braiam
May 16 '14 at 1:27
add a comment |Â
5 Answers
5
active
oldest
votes
up vote
44
down vote
You have to create the .ssh
directory and the authorized_keys
file the first time.
Create the
.ssh
directory:mkdir ~/.ssh
Set the right permissions:
chmod 700 ~/.ssh
Create the
authorized_keys
file:touch ~/.ssh/authorized_keys
Set the right permissions:
chmod 600 ~/.ssh/authorized_keys
The permissions are important! It won't work without the right permissions!
Now you can add the public key to the authorized_keys
file:
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
You have to add the public key of your computer to the authorized_keys
file of the computer you want to access using SSH Keys!
As terdon mentioned you can also just use this command:
ssh-copy-id user@host
This will put your id_rsa.pub
(in your ~/.ssh
directory) in the remote computer's authorized_keys
file, creating the .ssh
directory and authorized_keys
file with the right permissions if necessary.
2
In any case, you don't want to justcat
it, that's whatssh-copy-id
is for.
â terdonâ¦
May 15 '14 at 23:48
Wow, cool, I've added it.
â Louis Matthijssen
May 16 '14 at 6:41
add a comment |Â
up vote
2
down vote
In case you have been sent the public key in an email to install to a remote server:
1) SSH into the server. I used PuTTY on Windows.
2) Setup the key:
mkdir ~/.ssh
chmod 700 ~/.ssh
vi ~/.ssh/authorized_keys
Take care to copy the key exactly and paste it into a new line in the editor window. Verify that it occupies a single line and save.
chmod 600 ~/.ssh/authorized_keys
add a comment |Â
up vote
0
down vote
try
touch $HOME/.ssh/authorized_keys
to create empty file with the rights of that user.
This file is created when you access for the first a remote host with that user.
add a comment |Â
up vote
0
down vote
This can also fail if, when creating the key with ssh-keygen
, you give it a filename. I entered some name my-ssh-file-name
, and it wrote the key to /Users/MyUserName
instead of the .ssh
folder. If you leave the filename blank, it will write to .ssh
as expected.
add a comment |Â
up vote
0
down vote
Since I don't have enough reputation, I'm adding this here.
In addition to Louis Matthijssen's answer if you are still not able to login through ssh as a user that you've created, like
ssh username@host
then this may be because of the absence of owner permission that you must add to your /home/username/.ssh folder. I had the same issue and you can give this permission as:
chown -R username:username /home/username/.ssh
This can probably happen simply because you were creating the directory and setting the permissions as root, but not as the username you want to access the server with.
Hope this helps someone.
add a comment |Â
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
44
down vote
You have to create the .ssh
directory and the authorized_keys
file the first time.
Create the
.ssh
directory:mkdir ~/.ssh
Set the right permissions:
chmod 700 ~/.ssh
Create the
authorized_keys
file:touch ~/.ssh/authorized_keys
Set the right permissions:
chmod 600 ~/.ssh/authorized_keys
The permissions are important! It won't work without the right permissions!
Now you can add the public key to the authorized_keys
file:
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
You have to add the public key of your computer to the authorized_keys
file of the computer you want to access using SSH Keys!
As terdon mentioned you can also just use this command:
ssh-copy-id user@host
This will put your id_rsa.pub
(in your ~/.ssh
directory) in the remote computer's authorized_keys
file, creating the .ssh
directory and authorized_keys
file with the right permissions if necessary.
2
In any case, you don't want to justcat
it, that's whatssh-copy-id
is for.
â terdonâ¦
May 15 '14 at 23:48
Wow, cool, I've added it.
â Louis Matthijssen
May 16 '14 at 6:41
add a comment |Â
up vote
44
down vote
You have to create the .ssh
directory and the authorized_keys
file the first time.
Create the
.ssh
directory:mkdir ~/.ssh
Set the right permissions:
chmod 700 ~/.ssh
Create the
authorized_keys
file:touch ~/.ssh/authorized_keys
Set the right permissions:
chmod 600 ~/.ssh/authorized_keys
The permissions are important! It won't work without the right permissions!
Now you can add the public key to the authorized_keys
file:
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
You have to add the public key of your computer to the authorized_keys
file of the computer you want to access using SSH Keys!
As terdon mentioned you can also just use this command:
ssh-copy-id user@host
This will put your id_rsa.pub
(in your ~/.ssh
directory) in the remote computer's authorized_keys
file, creating the .ssh
directory and authorized_keys
file with the right permissions if necessary.
2
In any case, you don't want to justcat
it, that's whatssh-copy-id
is for.
â terdonâ¦
May 15 '14 at 23:48
Wow, cool, I've added it.
â Louis Matthijssen
May 16 '14 at 6:41
add a comment |Â
up vote
44
down vote
up vote
44
down vote
You have to create the .ssh
directory and the authorized_keys
file the first time.
Create the
.ssh
directory:mkdir ~/.ssh
Set the right permissions:
chmod 700 ~/.ssh
Create the
authorized_keys
file:touch ~/.ssh/authorized_keys
Set the right permissions:
chmod 600 ~/.ssh/authorized_keys
The permissions are important! It won't work without the right permissions!
Now you can add the public key to the authorized_keys
file:
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
You have to add the public key of your computer to the authorized_keys
file of the computer you want to access using SSH Keys!
As terdon mentioned you can also just use this command:
ssh-copy-id user@host
This will put your id_rsa.pub
(in your ~/.ssh
directory) in the remote computer's authorized_keys
file, creating the .ssh
directory and authorized_keys
file with the right permissions if necessary.
You have to create the .ssh
directory and the authorized_keys
file the first time.
Create the
.ssh
directory:mkdir ~/.ssh
Set the right permissions:
chmod 700 ~/.ssh
Create the
authorized_keys
file:touch ~/.ssh/authorized_keys
Set the right permissions:
chmod 600 ~/.ssh/authorized_keys
The permissions are important! It won't work without the right permissions!
Now you can add the public key to the authorized_keys
file:
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
You have to add the public key of your computer to the authorized_keys
file of the computer you want to access using SSH Keys!
As terdon mentioned you can also just use this command:
ssh-copy-id user@host
This will put your id_rsa.pub
(in your ~/.ssh
directory) in the remote computer's authorized_keys
file, creating the .ssh
directory and authorized_keys
file with the right permissions if necessary.
edited May 16 '14 at 6:40
answered May 15 '14 at 20:14
![](https://i.stack.imgur.com/PvaOl.png?s=32&g=1)
![](https://i.stack.imgur.com/PvaOl.png?s=32&g=1)
Louis Matthijssen
7,76643344
7,76643344
2
In any case, you don't want to justcat
it, that's whatssh-copy-id
is for.
â terdonâ¦
May 15 '14 at 23:48
Wow, cool, I've added it.
â Louis Matthijssen
May 16 '14 at 6:41
add a comment |Â
2
In any case, you don't want to justcat
it, that's whatssh-copy-id
is for.
â terdonâ¦
May 15 '14 at 23:48
Wow, cool, I've added it.
â Louis Matthijssen
May 16 '14 at 6:41
2
2
In any case, you don't want to just
cat
it, that's what ssh-copy-id
is for.â terdonâ¦
May 15 '14 at 23:48
In any case, you don't want to just
cat
it, that's what ssh-copy-id
is for.â terdonâ¦
May 15 '14 at 23:48
Wow, cool, I've added it.
â Louis Matthijssen
May 16 '14 at 6:41
Wow, cool, I've added it.
â Louis Matthijssen
May 16 '14 at 6:41
add a comment |Â
up vote
2
down vote
In case you have been sent the public key in an email to install to a remote server:
1) SSH into the server. I used PuTTY on Windows.
2) Setup the key:
mkdir ~/.ssh
chmod 700 ~/.ssh
vi ~/.ssh/authorized_keys
Take care to copy the key exactly and paste it into a new line in the editor window. Verify that it occupies a single line and save.
chmod 600 ~/.ssh/authorized_keys
add a comment |Â
up vote
2
down vote
In case you have been sent the public key in an email to install to a remote server:
1) SSH into the server. I used PuTTY on Windows.
2) Setup the key:
mkdir ~/.ssh
chmod 700 ~/.ssh
vi ~/.ssh/authorized_keys
Take care to copy the key exactly and paste it into a new line in the editor window. Verify that it occupies a single line and save.
chmod 600 ~/.ssh/authorized_keys
add a comment |Â
up vote
2
down vote
up vote
2
down vote
In case you have been sent the public key in an email to install to a remote server:
1) SSH into the server. I used PuTTY on Windows.
2) Setup the key:
mkdir ~/.ssh
chmod 700 ~/.ssh
vi ~/.ssh/authorized_keys
Take care to copy the key exactly and paste it into a new line in the editor window. Verify that it occupies a single line and save.
chmod 600 ~/.ssh/authorized_keys
In case you have been sent the public key in an email to install to a remote server:
1) SSH into the server. I used PuTTY on Windows.
2) Setup the key:
mkdir ~/.ssh
chmod 700 ~/.ssh
vi ~/.ssh/authorized_keys
Take care to copy the key exactly and paste it into a new line in the editor window. Verify that it occupies a single line and save.
chmod 600 ~/.ssh/authorized_keys
answered Jan 7 '16 at 0:29
KalenGi
163127
163127
add a comment |Â
add a comment |Â
up vote
0
down vote
try
touch $HOME/.ssh/authorized_keys
to create empty file with the rights of that user.
This file is created when you access for the first a remote host with that user.
add a comment |Â
up vote
0
down vote
try
touch $HOME/.ssh/authorized_keys
to create empty file with the rights of that user.
This file is created when you access for the first a remote host with that user.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
try
touch $HOME/.ssh/authorized_keys
to create empty file with the rights of that user.
This file is created when you access for the first a remote host with that user.
try
touch $HOME/.ssh/authorized_keys
to create empty file with the rights of that user.
This file is created when you access for the first a remote host with that user.
answered May 15 '14 at 20:13
DGA
1
1
add a comment |Â
add a comment |Â
up vote
0
down vote
This can also fail if, when creating the key with ssh-keygen
, you give it a filename. I entered some name my-ssh-file-name
, and it wrote the key to /Users/MyUserName
instead of the .ssh
folder. If you leave the filename blank, it will write to .ssh
as expected.
add a comment |Â
up vote
0
down vote
This can also fail if, when creating the key with ssh-keygen
, you give it a filename. I entered some name my-ssh-file-name
, and it wrote the key to /Users/MyUserName
instead of the .ssh
folder. If you leave the filename blank, it will write to .ssh
as expected.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
This can also fail if, when creating the key with ssh-keygen
, you give it a filename. I entered some name my-ssh-file-name
, and it wrote the key to /Users/MyUserName
instead of the .ssh
folder. If you leave the filename blank, it will write to .ssh
as expected.
This can also fail if, when creating the key with ssh-keygen
, you give it a filename. I entered some name my-ssh-file-name
, and it wrote the key to /Users/MyUserName
instead of the .ssh
folder. If you leave the filename blank, it will write to .ssh
as expected.
edited Sep 4 '15 at 21:35
answered Sep 4 '15 at 18:05
![](https://i.stack.imgur.com/AlvDJ.jpg?s=32&g=1)
![](https://i.stack.imgur.com/AlvDJ.jpg?s=32&g=1)
Francisco Corrales Morales
1467
1467
add a comment |Â
add a comment |Â
up vote
0
down vote
Since I don't have enough reputation, I'm adding this here.
In addition to Louis Matthijssen's answer if you are still not able to login through ssh as a user that you've created, like
ssh username@host
then this may be because of the absence of owner permission that you must add to your /home/username/.ssh folder. I had the same issue and you can give this permission as:
chown -R username:username /home/username/.ssh
This can probably happen simply because you were creating the directory and setting the permissions as root, but not as the username you want to access the server with.
Hope this helps someone.
add a comment |Â
up vote
0
down vote
Since I don't have enough reputation, I'm adding this here.
In addition to Louis Matthijssen's answer if you are still not able to login through ssh as a user that you've created, like
ssh username@host
then this may be because of the absence of owner permission that you must add to your /home/username/.ssh folder. I had the same issue and you can give this permission as:
chown -R username:username /home/username/.ssh
This can probably happen simply because you were creating the directory and setting the permissions as root, but not as the username you want to access the server with.
Hope this helps someone.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Since I don't have enough reputation, I'm adding this here.
In addition to Louis Matthijssen's answer if you are still not able to login through ssh as a user that you've created, like
ssh username@host
then this may be because of the absence of owner permission that you must add to your /home/username/.ssh folder. I had the same issue and you can give this permission as:
chown -R username:username /home/username/.ssh
This can probably happen simply because you were creating the directory and setting the permissions as root, but not as the username you want to access the server with.
Hope this helps someone.
Since I don't have enough reputation, I'm adding this here.
In addition to Louis Matthijssen's answer if you are still not able to login through ssh as a user that you've created, like
ssh username@host
then this may be because of the absence of owner permission that you must add to your /home/username/.ssh folder. I had the same issue and you can give this permission as:
chown -R username:username /home/username/.ssh
This can probably happen simply because you were creating the directory and setting the permissions as root, but not as the username you want to access the server with.
Hope this helps someone.
answered Jul 28 '17 at 8:33
Shivam Sharma
101
101
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
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%2faskubuntu.com%2fquestions%2f466549%2fbash-home-user-ssh-authorized-keys-no-such-file-or-directory%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
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');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
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');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
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
1
~/.ssh/authorized_keys
are keys of other computers that you connected to/trust, not your own key.â saiarcot895
May 15 '14 at 19:58
Some applications require passwordless ssh to one's own machine.
â Nehal J Wani
May 15 '14 at 20:03
Please don't post the same question on multiple sites of the Stack Exchange network.
â terdonâ¦
May 16 '14 at 0:43
Why you need to trust the key you own? Exactly what are you trying to do?
â Braiam
May 16 '14 at 1:27