SSH without password only works one time
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I want to configure SSH to use it without the need of writing the password. I am using Ubuntu 18.04 LTS on Windows 10. I need it to run Hadoop 3.1.1 (https://hadoop.apache.org/docs/r3.1.1/hadoop-project-dist/hadoop-common/SingleCluster.html#Standalone_Operation) using the pseudo-distributed mode.
I have tried a lot of different solutions but without any result. I obtained that the first time that I used the command ssh localhost I do not need to write the passphrase but when I write again I have to write the passphrase.
I explain the different steps that I have used:
- I have created a key using ssh-keygen -t rsa
- I add the public key to the authorized_keys files: cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
- I add the key executing: exec ssh-agent bash and ssh-add id_rsa (Years ago, in this point sometimes I had different problems and I used different solutions: https://superuser.com/questions/1147145/what-are-the-differences-between-the-those-ways-of-using-the-ssh-agent)
- I execute: ssh localhost
At this point all is right, but, when I execute again ssh localhost, then, I have to write the passphrase. These steps worked fine in the Ubuntu of AWS 3 years ago.
I have tried in the point 3 this other method: https://www.ssh.com/ssh/copy-id
All the possible solutions that I found said the same that I have tried in point 3, or I think that. I have tried to change permissions of authorized_keys and .ssh as I found in other solutions too but without success.
18.04 ssh configuration openssh hadoop
New contributor
add a comment |Â
up vote
1
down vote
favorite
I want to configure SSH to use it without the need of writing the password. I am using Ubuntu 18.04 LTS on Windows 10. I need it to run Hadoop 3.1.1 (https://hadoop.apache.org/docs/r3.1.1/hadoop-project-dist/hadoop-common/SingleCluster.html#Standalone_Operation) using the pseudo-distributed mode.
I have tried a lot of different solutions but without any result. I obtained that the first time that I used the command ssh localhost I do not need to write the passphrase but when I write again I have to write the passphrase.
I explain the different steps that I have used:
- I have created a key using ssh-keygen -t rsa
- I add the public key to the authorized_keys files: cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
- I add the key executing: exec ssh-agent bash and ssh-add id_rsa (Years ago, in this point sometimes I had different problems and I used different solutions: https://superuser.com/questions/1147145/what-are-the-differences-between-the-those-ways-of-using-the-ssh-agent)
- I execute: ssh localhost
At this point all is right, but, when I execute again ssh localhost, then, I have to write the passphrase. These steps worked fine in the Ubuntu of AWS 3 years ago.
I have tried in the point 3 this other method: https://www.ssh.com/ssh/copy-id
All the possible solutions that I found said the same that I have tried in point 3, or I think that. I have tried to change permissions of authorized_keys and .ssh as I found in other solutions too but without success.
18.04 ssh configuration openssh hadoop
New contributor
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I want to configure SSH to use it without the need of writing the password. I am using Ubuntu 18.04 LTS on Windows 10. I need it to run Hadoop 3.1.1 (https://hadoop.apache.org/docs/r3.1.1/hadoop-project-dist/hadoop-common/SingleCluster.html#Standalone_Operation) using the pseudo-distributed mode.
I have tried a lot of different solutions but without any result. I obtained that the first time that I used the command ssh localhost I do not need to write the passphrase but when I write again I have to write the passphrase.
I explain the different steps that I have used:
- I have created a key using ssh-keygen -t rsa
- I add the public key to the authorized_keys files: cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
- I add the key executing: exec ssh-agent bash and ssh-add id_rsa (Years ago, in this point sometimes I had different problems and I used different solutions: https://superuser.com/questions/1147145/what-are-the-differences-between-the-those-ways-of-using-the-ssh-agent)
- I execute: ssh localhost
At this point all is right, but, when I execute again ssh localhost, then, I have to write the passphrase. These steps worked fine in the Ubuntu of AWS 3 years ago.
I have tried in the point 3 this other method: https://www.ssh.com/ssh/copy-id
All the possible solutions that I found said the same that I have tried in point 3, or I think that. I have tried to change permissions of authorized_keys and .ssh as I found in other solutions too but without success.
18.04 ssh configuration openssh hadoop
New contributor
I want to configure SSH to use it without the need of writing the password. I am using Ubuntu 18.04 LTS on Windows 10. I need it to run Hadoop 3.1.1 (https://hadoop.apache.org/docs/r3.1.1/hadoop-project-dist/hadoop-common/SingleCluster.html#Standalone_Operation) using the pseudo-distributed mode.
I have tried a lot of different solutions but without any result. I obtained that the first time that I used the command ssh localhost I do not need to write the passphrase but when I write again I have to write the passphrase.
I explain the different steps that I have used:
- I have created a key using ssh-keygen -t rsa
- I add the public key to the authorized_keys files: cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
- I add the key executing: exec ssh-agent bash and ssh-add id_rsa (Years ago, in this point sometimes I had different problems and I used different solutions: https://superuser.com/questions/1147145/what-are-the-differences-between-the-those-ways-of-using-the-ssh-agent)
- I execute: ssh localhost
At this point all is right, but, when I execute again ssh localhost, then, I have to write the passphrase. These steps worked fine in the Ubuntu of AWS 3 years ago.
I have tried in the point 3 this other method: https://www.ssh.com/ssh/copy-id
All the possible solutions that I found said the same that I have tried in point 3, or I think that. I have tried to change permissions of authorized_keys and .ssh as I found in other solutions too but without success.
18.04 ssh configuration openssh hadoop
18.04 ssh configuration openssh hadoop
New contributor
New contributor
New contributor
asked 3 hours ago
CGG
1063
1063
New contributor
New contributor
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
You should take a look at this answer which describes configuring ssh
for your user (editing ~/.ssh/config
) and other details.
The steps are:
- Generate your
ssh
key. - Add the Host to your
~/.ssh/config
file. - Add your Public (
.pub
) key to the remote user's~/.ssh/authorized_keys
- This is most easily done with
ssh-copy-id
command. ssh
is very particular about the permissions of~/.ssh/
and the files found within.ssh-copy-id
handles everything for you.
- This is most easily done with
- Try connecting to the Host:
ssh host
ssh host -vvv # Verbose output for troubleshooting
Are you trying to use ssh-agent
because your keys are protected by a password? I would recommend working on manually connecting without ssh-agent
and getting that working. After you have your key working, you can work on solving any of the ssh-agent
-specific issues.
To troubleshoot, be sure to use ssh
in a verbose mode, and also monitor (tail -f
) the remote server's /var/log/auth.log
file. On newer systems, you may have to use journalctl
(journalctl -u sshd | tail -f
).
Once you've gotten the key working in general, you can look into ssh-agent
documentation, such as this set of setup instructions. Typically the steps are as follows:
- Generate your keys (as you have already done).
- Install the keys (as you have already done).
- Start
ssh-agent
eval ssh-agent
- Only once, not each connection or anything.
- You can have this happen automatically, depending on when and for which user.
- Add your key to
ssh-agent
:ssh-add ~/.ssh/private_key
Be sure to look into other ssh-agent
configuration options, such as the duration your keys will remain unlocked.
Boiling it down a bit, your problem is most likely one of these:
You say you added
ssh-agent
starting, and the addition of yourid_rsa
key (in the past), but now that you've generated a new key, that key will also need to bessh-add
'd.- Check that
ssh-agent
is actually running on your system if you have problems after adding the key. ps aux | ssh-agent
- Check that
You're adding the key to your local file, not the remote user's file.
- Think of it like you're adding a password, so you need to add the password on the system which should accept it.
Your remote host is localhost, but this assumes you'll want to be able to work on remote hosts in the future.
- You say it works a single time? Does it work twice if you try two times in a shorter timeframe, say one minute? I am trying to understand if your
ssh-agent
is just set up to lock your key in a shorter timeframe than you've tested. - When appending to the
~/.ssh/authorized_keys
file (>>
), you initially created the file, and this would be with incorrect permissions.- Do not do the following without securing access, and making backups to any remote files.
- If your 'remote host' is localhost, it very likely has files you want to keep, such as your keys, and should be backed up before removal.
- Delete the entire remote
~/.ssh/
directory and usessh-copy-id
to properly key your user on the remote host. - This would show up on the remote host's
auth.log
and specify that the file permissions are incorrect. - If you continue to experience issues after using
ssh-copy-id
to create the directory and files, post the permissions of~/.ssh
and your generated key files.
THX: 2 problems. If I use 'eval ssh-agent' because when I use ssh-add id_rsa the system return me 'Could not open a connection to your authentication agent.' Then, I have to use 'exec ssh-agent bash'.
â CGG
1 hour ago
The other problem: I said it works in a single time because I execute 'ssh localhost' and then I do not require to introduce the passphrase. If I execute again 'ssh localhost', then, I have to insert the passphrase.
â CGG
1 hour ago
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
You should take a look at this answer which describes configuring ssh
for your user (editing ~/.ssh/config
) and other details.
The steps are:
- Generate your
ssh
key. - Add the Host to your
~/.ssh/config
file. - Add your Public (
.pub
) key to the remote user's~/.ssh/authorized_keys
- This is most easily done with
ssh-copy-id
command. ssh
is very particular about the permissions of~/.ssh/
and the files found within.ssh-copy-id
handles everything for you.
- This is most easily done with
- Try connecting to the Host:
ssh host
ssh host -vvv # Verbose output for troubleshooting
Are you trying to use ssh-agent
because your keys are protected by a password? I would recommend working on manually connecting without ssh-agent
and getting that working. After you have your key working, you can work on solving any of the ssh-agent
-specific issues.
To troubleshoot, be sure to use ssh
in a verbose mode, and also monitor (tail -f
) the remote server's /var/log/auth.log
file. On newer systems, you may have to use journalctl
(journalctl -u sshd | tail -f
).
Once you've gotten the key working in general, you can look into ssh-agent
documentation, such as this set of setup instructions. Typically the steps are as follows:
- Generate your keys (as you have already done).
- Install the keys (as you have already done).
- Start
ssh-agent
eval ssh-agent
- Only once, not each connection or anything.
- You can have this happen automatically, depending on when and for which user.
- Add your key to
ssh-agent
:ssh-add ~/.ssh/private_key
Be sure to look into other ssh-agent
configuration options, such as the duration your keys will remain unlocked.
Boiling it down a bit, your problem is most likely one of these:
You say you added
ssh-agent
starting, and the addition of yourid_rsa
key (in the past), but now that you've generated a new key, that key will also need to bessh-add
'd.- Check that
ssh-agent
is actually running on your system if you have problems after adding the key. ps aux | ssh-agent
- Check that
You're adding the key to your local file, not the remote user's file.
- Think of it like you're adding a password, so you need to add the password on the system which should accept it.
Your remote host is localhost, but this assumes you'll want to be able to work on remote hosts in the future.
- You say it works a single time? Does it work twice if you try two times in a shorter timeframe, say one minute? I am trying to understand if your
ssh-agent
is just set up to lock your key in a shorter timeframe than you've tested. - When appending to the
~/.ssh/authorized_keys
file (>>
), you initially created the file, and this would be with incorrect permissions.- Do not do the following without securing access, and making backups to any remote files.
- If your 'remote host' is localhost, it very likely has files you want to keep, such as your keys, and should be backed up before removal.
- Delete the entire remote
~/.ssh/
directory and usessh-copy-id
to properly key your user on the remote host. - This would show up on the remote host's
auth.log
and specify that the file permissions are incorrect. - If you continue to experience issues after using
ssh-copy-id
to create the directory and files, post the permissions of~/.ssh
and your generated key files.
THX: 2 problems. If I use 'eval ssh-agent' because when I use ssh-add id_rsa the system return me 'Could not open a connection to your authentication agent.' Then, I have to use 'exec ssh-agent bash'.
â CGG
1 hour ago
The other problem: I said it works in a single time because I execute 'ssh localhost' and then I do not require to introduce the passphrase. If I execute again 'ssh localhost', then, I have to insert the passphrase.
â CGG
1 hour ago
add a comment |Â
up vote
3
down vote
You should take a look at this answer which describes configuring ssh
for your user (editing ~/.ssh/config
) and other details.
The steps are:
- Generate your
ssh
key. - Add the Host to your
~/.ssh/config
file. - Add your Public (
.pub
) key to the remote user's~/.ssh/authorized_keys
- This is most easily done with
ssh-copy-id
command. ssh
is very particular about the permissions of~/.ssh/
and the files found within.ssh-copy-id
handles everything for you.
- This is most easily done with
- Try connecting to the Host:
ssh host
ssh host -vvv # Verbose output for troubleshooting
Are you trying to use ssh-agent
because your keys are protected by a password? I would recommend working on manually connecting without ssh-agent
and getting that working. After you have your key working, you can work on solving any of the ssh-agent
-specific issues.
To troubleshoot, be sure to use ssh
in a verbose mode, and also monitor (tail -f
) the remote server's /var/log/auth.log
file. On newer systems, you may have to use journalctl
(journalctl -u sshd | tail -f
).
Once you've gotten the key working in general, you can look into ssh-agent
documentation, such as this set of setup instructions. Typically the steps are as follows:
- Generate your keys (as you have already done).
- Install the keys (as you have already done).
- Start
ssh-agent
eval ssh-agent
- Only once, not each connection or anything.
- You can have this happen automatically, depending on when and for which user.
- Add your key to
ssh-agent
:ssh-add ~/.ssh/private_key
Be sure to look into other ssh-agent
configuration options, such as the duration your keys will remain unlocked.
Boiling it down a bit, your problem is most likely one of these:
You say you added
ssh-agent
starting, and the addition of yourid_rsa
key (in the past), but now that you've generated a new key, that key will also need to bessh-add
'd.- Check that
ssh-agent
is actually running on your system if you have problems after adding the key. ps aux | ssh-agent
- Check that
You're adding the key to your local file, not the remote user's file.
- Think of it like you're adding a password, so you need to add the password on the system which should accept it.
Your remote host is localhost, but this assumes you'll want to be able to work on remote hosts in the future.
- You say it works a single time? Does it work twice if you try two times in a shorter timeframe, say one minute? I am trying to understand if your
ssh-agent
is just set up to lock your key in a shorter timeframe than you've tested. - When appending to the
~/.ssh/authorized_keys
file (>>
), you initially created the file, and this would be with incorrect permissions.- Do not do the following without securing access, and making backups to any remote files.
- If your 'remote host' is localhost, it very likely has files you want to keep, such as your keys, and should be backed up before removal.
- Delete the entire remote
~/.ssh/
directory and usessh-copy-id
to properly key your user on the remote host. - This would show up on the remote host's
auth.log
and specify that the file permissions are incorrect. - If you continue to experience issues after using
ssh-copy-id
to create the directory and files, post the permissions of~/.ssh
and your generated key files.
THX: 2 problems. If I use 'eval ssh-agent' because when I use ssh-add id_rsa the system return me 'Could not open a connection to your authentication agent.' Then, I have to use 'exec ssh-agent bash'.
â CGG
1 hour ago
The other problem: I said it works in a single time because I execute 'ssh localhost' and then I do not require to introduce the passphrase. If I execute again 'ssh localhost', then, I have to insert the passphrase.
â CGG
1 hour ago
add a comment |Â
up vote
3
down vote
up vote
3
down vote
You should take a look at this answer which describes configuring ssh
for your user (editing ~/.ssh/config
) and other details.
The steps are:
- Generate your
ssh
key. - Add the Host to your
~/.ssh/config
file. - Add your Public (
.pub
) key to the remote user's~/.ssh/authorized_keys
- This is most easily done with
ssh-copy-id
command. ssh
is very particular about the permissions of~/.ssh/
and the files found within.ssh-copy-id
handles everything for you.
- This is most easily done with
- Try connecting to the Host:
ssh host
ssh host -vvv # Verbose output for troubleshooting
Are you trying to use ssh-agent
because your keys are protected by a password? I would recommend working on manually connecting without ssh-agent
and getting that working. After you have your key working, you can work on solving any of the ssh-agent
-specific issues.
To troubleshoot, be sure to use ssh
in a verbose mode, and also monitor (tail -f
) the remote server's /var/log/auth.log
file. On newer systems, you may have to use journalctl
(journalctl -u sshd | tail -f
).
Once you've gotten the key working in general, you can look into ssh-agent
documentation, such as this set of setup instructions. Typically the steps are as follows:
- Generate your keys (as you have already done).
- Install the keys (as you have already done).
- Start
ssh-agent
eval ssh-agent
- Only once, not each connection or anything.
- You can have this happen automatically, depending on when and for which user.
- Add your key to
ssh-agent
:ssh-add ~/.ssh/private_key
Be sure to look into other ssh-agent
configuration options, such as the duration your keys will remain unlocked.
Boiling it down a bit, your problem is most likely one of these:
You say you added
ssh-agent
starting, and the addition of yourid_rsa
key (in the past), but now that you've generated a new key, that key will also need to bessh-add
'd.- Check that
ssh-agent
is actually running on your system if you have problems after adding the key. ps aux | ssh-agent
- Check that
You're adding the key to your local file, not the remote user's file.
- Think of it like you're adding a password, so you need to add the password on the system which should accept it.
Your remote host is localhost, but this assumes you'll want to be able to work on remote hosts in the future.
- You say it works a single time? Does it work twice if you try two times in a shorter timeframe, say one minute? I am trying to understand if your
ssh-agent
is just set up to lock your key in a shorter timeframe than you've tested. - When appending to the
~/.ssh/authorized_keys
file (>>
), you initially created the file, and this would be with incorrect permissions.- Do not do the following without securing access, and making backups to any remote files.
- If your 'remote host' is localhost, it very likely has files you want to keep, such as your keys, and should be backed up before removal.
- Delete the entire remote
~/.ssh/
directory and usessh-copy-id
to properly key your user on the remote host. - This would show up on the remote host's
auth.log
and specify that the file permissions are incorrect. - If you continue to experience issues after using
ssh-copy-id
to create the directory and files, post the permissions of~/.ssh
and your generated key files.
You should take a look at this answer which describes configuring ssh
for your user (editing ~/.ssh/config
) and other details.
The steps are:
- Generate your
ssh
key. - Add the Host to your
~/.ssh/config
file. - Add your Public (
.pub
) key to the remote user's~/.ssh/authorized_keys
- This is most easily done with
ssh-copy-id
command. ssh
is very particular about the permissions of~/.ssh/
and the files found within.ssh-copy-id
handles everything for you.
- This is most easily done with
- Try connecting to the Host:
ssh host
ssh host -vvv # Verbose output for troubleshooting
Are you trying to use ssh-agent
because your keys are protected by a password? I would recommend working on manually connecting without ssh-agent
and getting that working. After you have your key working, you can work on solving any of the ssh-agent
-specific issues.
To troubleshoot, be sure to use ssh
in a verbose mode, and also monitor (tail -f
) the remote server's /var/log/auth.log
file. On newer systems, you may have to use journalctl
(journalctl -u sshd | tail -f
).
Once you've gotten the key working in general, you can look into ssh-agent
documentation, such as this set of setup instructions. Typically the steps are as follows:
- Generate your keys (as you have already done).
- Install the keys (as you have already done).
- Start
ssh-agent
eval ssh-agent
- Only once, not each connection or anything.
- You can have this happen automatically, depending on when and for which user.
- Add your key to
ssh-agent
:ssh-add ~/.ssh/private_key
Be sure to look into other ssh-agent
configuration options, such as the duration your keys will remain unlocked.
Boiling it down a bit, your problem is most likely one of these:
You say you added
ssh-agent
starting, and the addition of yourid_rsa
key (in the past), but now that you've generated a new key, that key will also need to bessh-add
'd.- Check that
ssh-agent
is actually running on your system if you have problems after adding the key. ps aux | ssh-agent
- Check that
You're adding the key to your local file, not the remote user's file.
- Think of it like you're adding a password, so you need to add the password on the system which should accept it.
Your remote host is localhost, but this assumes you'll want to be able to work on remote hosts in the future.
- You say it works a single time? Does it work twice if you try two times in a shorter timeframe, say one minute? I am trying to understand if your
ssh-agent
is just set up to lock your key in a shorter timeframe than you've tested. - When appending to the
~/.ssh/authorized_keys
file (>>
), you initially created the file, and this would be with incorrect permissions.- Do not do the following without securing access, and making backups to any remote files.
- If your 'remote host' is localhost, it very likely has files you want to keep, such as your keys, and should be backed up before removal.
- Delete the entire remote
~/.ssh/
directory and usessh-copy-id
to properly key your user on the remote host. - This would show up on the remote host's
auth.log
and specify that the file permissions are incorrect. - If you continue to experience issues after using
ssh-copy-id
to create the directory and files, post the permissions of~/.ssh
and your generated key files.
edited 2 hours ago
answered 3 hours ago
earthmeLon
6,0331648
6,0331648
THX: 2 problems. If I use 'eval ssh-agent' because when I use ssh-add id_rsa the system return me 'Could not open a connection to your authentication agent.' Then, I have to use 'exec ssh-agent bash'.
â CGG
1 hour ago
The other problem: I said it works in a single time because I execute 'ssh localhost' and then I do not require to introduce the passphrase. If I execute again 'ssh localhost', then, I have to insert the passphrase.
â CGG
1 hour ago
add a comment |Â
THX: 2 problems. If I use 'eval ssh-agent' because when I use ssh-add id_rsa the system return me 'Could not open a connection to your authentication agent.' Then, I have to use 'exec ssh-agent bash'.
â CGG
1 hour ago
The other problem: I said it works in a single time because I execute 'ssh localhost' and then I do not require to introduce the passphrase. If I execute again 'ssh localhost', then, I have to insert the passphrase.
â CGG
1 hour ago
THX: 2 problems. If I use 'eval ssh-agent' because when I use ssh-add id_rsa the system return me 'Could not open a connection to your authentication agent.' Then, I have to use 'exec ssh-agent bash'.
â CGG
1 hour ago
THX: 2 problems. If I use 'eval ssh-agent' because when I use ssh-add id_rsa the system return me 'Could not open a connection to your authentication agent.' Then, I have to use 'exec ssh-agent bash'.
â CGG
1 hour ago
The other problem: I said it works in a single time because I execute 'ssh localhost' and then I do not require to introduce the passphrase. If I execute again 'ssh localhost', then, I have to insert the passphrase.
â CGG
1 hour ago
The other problem: I said it works in a single time because I execute 'ssh localhost' and then I do not require to introduce the passphrase. If I execute again 'ssh localhost', then, I have to insert the passphrase.
â CGG
1 hour ago
add a comment |Â
CGG is a new contributor. Be nice, and check out our Code of Conduct.
CGG is a new contributor. Be nice, and check out our Code of Conduct.
CGG is a new contributor. Be nice, and check out our Code of Conduct.
CGG 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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1081784%2fssh-without-password-only-works-one-time%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