How to ssh to remote in script without having to provide a passwordconnect to a remote server through sshsftp...
Have I found a major security issue with login
Who is frowning in the sentence "Daisy looked at Tom frowning"?
Why didn't Daenerys' advisers suggest assassinating Cersei?
Windows reverting changes made by Linux to FAT32 partition
Parse a C++14 integer literal
How to safely discharge oneself
pwaS eht tirsf dna tasl setterl fo hace dorw
Can 2 light bulbs of 120V in series be used on 230V AC?
Does science define life as "beginning at conception"?
Why does the U.S military use mercenaries?
Why would Thor need to strike a building with lightning to attack enemies?
Was Tyrion always a poor strategist?
Why does snapping your fingers activate the Infinity Gauntlet?
Failing students when it might cause them economic ruin
Was murdering a slave illegal in American slavery, and if so, what punishments were given for it?
Vehemently against code formatting
Have the writers and actors of Game Of Thrones responded to its poor reception?
Is my company merging branches wrong?
Why are Marine Le Pen's possible connections with Steve Bannon something worth investigating?
What city and town structures are important in a low fantasy medieval world?
Isn't Kirchhoff's junction law a violation of conservation of charge?
Novel where a cube cooled below absolute zero makes a hole in reality
Does the Aboleth have expertise in history and perception?
What is the backup for a glass cockpit, if a plane loses power to the displays/controls?
How to ssh to remote in script without having to provide a password
connect to a remote server through sshsftp script to get a file from remote machineHow to ssh and execute a remote script within a local shell script?provide password for script begin called inside another scriptshell scripting remote commands through sshExport mysql to remote server using one SSH sessionssh execute remote scriptHow to pass multiple arguments through ssh and use those arguments in the ssh script?How to remote execute ssh command a sudo command without passwordConnecting with ssh without password
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I am executing the following in my script:
ssh pi@192.169.1.89
Which asks me for a password
pi@192.169.1.89's password:
How do I execute the script to create the ssh connection and then pass the password into it, so I don't have to type it?
linux shell-script
New contributor
add a comment |
I am executing the following in my script:
ssh pi@192.169.1.89
Which asks me for a password
pi@192.169.1.89's password:
How do I execute the script to create the ssh connection and then pass the password into it, so I don't have to type it?
linux shell-script
New contributor
add a comment |
I am executing the following in my script:
ssh pi@192.169.1.89
Which asks me for a password
pi@192.169.1.89's password:
How do I execute the script to create the ssh connection and then pass the password into it, so I don't have to type it?
linux shell-script
New contributor
I am executing the following in my script:
ssh pi@192.169.1.89
Which asks me for a password
pi@192.169.1.89's password:
How do I execute the script to create the ssh connection and then pass the password into it, so I don't have to type it?
linux shell-script
linux shell-script
New contributor
New contributor
edited 37 mins ago
somethingSomething
1,943103462
1,943103462
New contributor
asked 1 hour ago
user10204157user10204157
84
84
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
What your looking for is ssh keys
, then you wont have to type a password
.
To generate RSA keys, on the command line, enter:
ssh-keygen -o -b 4096 -t rsa
NOTE THIS:
If you don't password-protect your private key, anyone with access to your computer conceivably can SSH (without being prompted for a password) to your account on any remote system that has the corresponding public key.
Your private key will be generated using the default filename (for example, id_rsa
) or the filename you specified (for example, my_ssh_key), and stored on your computer in a .ssh directory off your home directory (for example, ~/.ssh/id_rsa
or ~/.ssh/my_ssh_key
).
If your account on the remote system doesn't already contain a ~/.ssh/authorized_keys
file, create one; on the command line, enter the following commands:
mkdir -p ~/.ssh
touch ~/.ssh/authorized_keys
To copy your key to the remote server:
ssh-copy-id
is a utility available on some operating systems that can copy a SSH
public key to a remote server over SSH
.
To use ssh-copy-id
, pass your username and the IP address of the server you would like to access:
ssh-copy-id USER@IP-ADDRESS
ref:
Use Public Key Authentication with SSH
Set up SSH public-key authentication to connect to a remote system
add a comment |
There are several ways to do this, but I recommend using public/private keys rather than passing the password (which is possible). There are many other answers on this - but here is a quick how to:
On the machine you are logging in from:
Create a public/private key combination:
ssh-keygen -t rsa
Copy the public key to the remote machine:
ssh-copy-id pi@192.168.1.89
You will then need to type your password, and the public key will be copied to 192.168.1.89. At this point you will no longer be asked for your password upon logging in from the first machine.
New contributor
add a comment |
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
});
}
});
user10204157 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%2f519626%2fhow-to-ssh-to-remote-in-script-without-having-to-provide-a-password%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
What your looking for is ssh keys
, then you wont have to type a password
.
To generate RSA keys, on the command line, enter:
ssh-keygen -o -b 4096 -t rsa
NOTE THIS:
If you don't password-protect your private key, anyone with access to your computer conceivably can SSH (without being prompted for a password) to your account on any remote system that has the corresponding public key.
Your private key will be generated using the default filename (for example, id_rsa
) or the filename you specified (for example, my_ssh_key), and stored on your computer in a .ssh directory off your home directory (for example, ~/.ssh/id_rsa
or ~/.ssh/my_ssh_key
).
If your account on the remote system doesn't already contain a ~/.ssh/authorized_keys
file, create one; on the command line, enter the following commands:
mkdir -p ~/.ssh
touch ~/.ssh/authorized_keys
To copy your key to the remote server:
ssh-copy-id
is a utility available on some operating systems that can copy a SSH
public key to a remote server over SSH
.
To use ssh-copy-id
, pass your username and the IP address of the server you would like to access:
ssh-copy-id USER@IP-ADDRESS
ref:
Use Public Key Authentication with SSH
Set up SSH public-key authentication to connect to a remote system
add a comment |
What your looking for is ssh keys
, then you wont have to type a password
.
To generate RSA keys, on the command line, enter:
ssh-keygen -o -b 4096 -t rsa
NOTE THIS:
If you don't password-protect your private key, anyone with access to your computer conceivably can SSH (without being prompted for a password) to your account on any remote system that has the corresponding public key.
Your private key will be generated using the default filename (for example, id_rsa
) or the filename you specified (for example, my_ssh_key), and stored on your computer in a .ssh directory off your home directory (for example, ~/.ssh/id_rsa
or ~/.ssh/my_ssh_key
).
If your account on the remote system doesn't already contain a ~/.ssh/authorized_keys
file, create one; on the command line, enter the following commands:
mkdir -p ~/.ssh
touch ~/.ssh/authorized_keys
To copy your key to the remote server:
ssh-copy-id
is a utility available on some operating systems that can copy a SSH
public key to a remote server over SSH
.
To use ssh-copy-id
, pass your username and the IP address of the server you would like to access:
ssh-copy-id USER@IP-ADDRESS
ref:
Use Public Key Authentication with SSH
Set up SSH public-key authentication to connect to a remote system
add a comment |
What your looking for is ssh keys
, then you wont have to type a password
.
To generate RSA keys, on the command line, enter:
ssh-keygen -o -b 4096 -t rsa
NOTE THIS:
If you don't password-protect your private key, anyone with access to your computer conceivably can SSH (without being prompted for a password) to your account on any remote system that has the corresponding public key.
Your private key will be generated using the default filename (for example, id_rsa
) or the filename you specified (for example, my_ssh_key), and stored on your computer in a .ssh directory off your home directory (for example, ~/.ssh/id_rsa
or ~/.ssh/my_ssh_key
).
If your account on the remote system doesn't already contain a ~/.ssh/authorized_keys
file, create one; on the command line, enter the following commands:
mkdir -p ~/.ssh
touch ~/.ssh/authorized_keys
To copy your key to the remote server:
ssh-copy-id
is a utility available on some operating systems that can copy a SSH
public key to a remote server over SSH
.
To use ssh-copy-id
, pass your username and the IP address of the server you would like to access:
ssh-copy-id USER@IP-ADDRESS
ref:
Use Public Key Authentication with SSH
Set up SSH public-key authentication to connect to a remote system
What your looking for is ssh keys
, then you wont have to type a password
.
To generate RSA keys, on the command line, enter:
ssh-keygen -o -b 4096 -t rsa
NOTE THIS:
If you don't password-protect your private key, anyone with access to your computer conceivably can SSH (without being prompted for a password) to your account on any remote system that has the corresponding public key.
Your private key will be generated using the default filename (for example, id_rsa
) or the filename you specified (for example, my_ssh_key), and stored on your computer in a .ssh directory off your home directory (for example, ~/.ssh/id_rsa
or ~/.ssh/my_ssh_key
).
If your account on the remote system doesn't already contain a ~/.ssh/authorized_keys
file, create one; on the command line, enter the following commands:
mkdir -p ~/.ssh
touch ~/.ssh/authorized_keys
To copy your key to the remote server:
ssh-copy-id
is a utility available on some operating systems that can copy a SSH
public key to a remote server over SSH
.
To use ssh-copy-id
, pass your username and the IP address of the server you would like to access:
ssh-copy-id USER@IP-ADDRESS
ref:
Use Public Key Authentication with SSH
Set up SSH public-key authentication to connect to a remote system
answered 1 hour ago
somethingSomethingsomethingSomething
1,943103462
1,943103462
add a comment |
add a comment |
There are several ways to do this, but I recommend using public/private keys rather than passing the password (which is possible). There are many other answers on this - but here is a quick how to:
On the machine you are logging in from:
Create a public/private key combination:
ssh-keygen -t rsa
Copy the public key to the remote machine:
ssh-copy-id pi@192.168.1.89
You will then need to type your password, and the public key will be copied to 192.168.1.89. At this point you will no longer be asked for your password upon logging in from the first machine.
New contributor
add a comment |
There are several ways to do this, but I recommend using public/private keys rather than passing the password (which is possible). There are many other answers on this - but here is a quick how to:
On the machine you are logging in from:
Create a public/private key combination:
ssh-keygen -t rsa
Copy the public key to the remote machine:
ssh-copy-id pi@192.168.1.89
You will then need to type your password, and the public key will be copied to 192.168.1.89. At this point you will no longer be asked for your password upon logging in from the first machine.
New contributor
add a comment |
There are several ways to do this, but I recommend using public/private keys rather than passing the password (which is possible). There are many other answers on this - but here is a quick how to:
On the machine you are logging in from:
Create a public/private key combination:
ssh-keygen -t rsa
Copy the public key to the remote machine:
ssh-copy-id pi@192.168.1.89
You will then need to type your password, and the public key will be copied to 192.168.1.89. At this point you will no longer be asked for your password upon logging in from the first machine.
New contributor
There are several ways to do this, but I recommend using public/private keys rather than passing the password (which is possible). There are many other answers on this - but here is a quick how to:
On the machine you are logging in from:
Create a public/private key combination:
ssh-keygen -t rsa
Copy the public key to the remote machine:
ssh-copy-id pi@192.168.1.89
You will then need to type your password, and the public key will be copied to 192.168.1.89. At this point you will no longer be asked for your password upon logging in from the first machine.
New contributor
New contributor
answered 1 hour ago
ScotScot
1112
1112
New contributor
New contributor
add a comment |
add a comment |
user10204157 is a new contributor. Be nice, and check out our Code of Conduct.
user10204157 is a new contributor. Be nice, and check out our Code of Conduct.
user10204157 is a new contributor. Be nice, and check out our Code of Conduct.
user10204157 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%2f519626%2fhow-to-ssh-to-remote-in-script-without-having-to-provide-a-password%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