ssh to multi serversUnable to access an http sevice forwarded using sshssh and run script on remote host and...

Do any aircraft carry boats?

How is the Team Scooby Doo funded?

Can the UK veto its own extension request?

Can I use ratchet straps to lift a dolly into a truck bed?

Is it appropriate for a professor to require students to sign a non-disclosure agreement before being taught?

Is the union of a chain of elementary embeddings elementary?

Is there a star over my head?

How can I maximize the impact of my charitable donations?

Are the definite and indefinite integrals actually two different things? Where is the flaw in my understanding?

Is there a standard terminology for female equivalents of terms such as 'Kingdom' and if so, what are the most common terms?

Georgian capital letter “Ⴒ” (“tar”) in pdfLaTeX

How to help my 2.5-year-old daughter take her medicine when she refuses to?

Do all humans have an identical nucleotide sequence for certain proteins, e.g haemoglobin?

Why should I always enable compiler warnings?

How do you build a Dominant 7th chord?

A Little Riddle

Is it possible to PIVOT on a LIKE statement

My research paper filed as a patent in China by my Chinese supervisor without me as inventor

Can a magnet rip protons from a nucleus?

Do ibuprofen or paracetamol cause hearing loss?

Are Democrats more likely to believe Astrology is a science?

How to work with a technician hired with a grant who argues everything

My employer wants me to do a work of 6 months in just 2 months

Converting multiple assignment statements to single comma separated assignment



ssh to multi servers


Unable to access an http sevice forwarded using sshssh and run script on remote host and answer expect answer automateExport mysql to remote server using one SSH sessionScript to connect with ssh to remote server with passwordsudo: pam_authenticate: Conversation error






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















is there a way to make a script to act like a host file,



so i would like to say



./test1 


and it ask me what's the name of the server i type "server1" and the script grap the IP address from a file and ssh to it, i manged to make it work with sshpass but not without the ip !



while read -p 'Enter the ip address for the server: ' ip_addr && [[ -z "$ip_addr" ]] ; do
echo " please, no blank IP address!"

sshpass -p "$password" ssh -o StrictHostKeyChecking=no $ip_addr "x=$y" /bin/bash << "EOF"
sudo su - $x









share|improve this question



























  • that script fragment is broken. missing the ending "EOF" to start with.

    – cas
    18 mins ago











  • thank you, this is a part of the script not all of it

    – Jack albars
    4 mins ago


















0















is there a way to make a script to act like a host file,



so i would like to say



./test1 


and it ask me what's the name of the server i type "server1" and the script grap the IP address from a file and ssh to it, i manged to make it work with sshpass but not without the ip !



while read -p 'Enter the ip address for the server: ' ip_addr && [[ -z "$ip_addr" ]] ; do
echo " please, no blank IP address!"

sshpass -p "$password" ssh -o StrictHostKeyChecking=no $ip_addr "x=$y" /bin/bash << "EOF"
sudo su - $x









share|improve this question



























  • that script fragment is broken. missing the ending "EOF" to start with.

    – cas
    18 mins ago











  • thank you, this is a part of the script not all of it

    – Jack albars
    4 mins ago














0












0








0








is there a way to make a script to act like a host file,



so i would like to say



./test1 


and it ask me what's the name of the server i type "server1" and the script grap the IP address from a file and ssh to it, i manged to make it work with sshpass but not without the ip !



while read -p 'Enter the ip address for the server: ' ip_addr && [[ -z "$ip_addr" ]] ; do
echo " please, no blank IP address!"

sshpass -p "$password" ssh -o StrictHostKeyChecking=no $ip_addr "x=$y" /bin/bash << "EOF"
sudo su - $x









share|improve this question
















is there a way to make a script to act like a host file,



so i would like to say



./test1 


and it ask me what's the name of the server i type "server1" and the script grap the IP address from a file and ssh to it, i manged to make it work with sshpass but not without the ip !



while read -p 'Enter the ip address for the server: ' ip_addr && [[ -z "$ip_addr" ]] ; do
echo " please, no blank IP address!"

sshpass -p "$password" ssh -o StrictHostKeyChecking=no $ip_addr "x=$y" /bin/bash << "EOF"
sudo su - $x






linux bash shell-script






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 19 mins ago









cas

43.1k4 gold badges62 silver badges112 bronze badges




43.1k4 gold badges62 silver badges112 bronze badges










asked 25 mins ago









Jack albarsJack albars

42 bronze badges




42 bronze badges
















  • that script fragment is broken. missing the ending "EOF" to start with.

    – cas
    18 mins ago











  • thank you, this is a part of the script not all of it

    – Jack albars
    4 mins ago



















  • that script fragment is broken. missing the ending "EOF" to start with.

    – cas
    18 mins ago











  • thank you, this is a part of the script not all of it

    – Jack albars
    4 mins ago

















that script fragment is broken. missing the ending "EOF" to start with.

– cas
18 mins ago





that script fragment is broken. missing the ending "EOF" to start with.

– cas
18 mins ago













thank you, this is a part of the script not all of it

– Jack albars
4 mins ago





thank you, this is a part of the script not all of it

– Jack albars
4 mins ago










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/4.0/"u003ecc by-sa 4.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
});


}
});















draft saved

draft discarded
















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f541106%2fssh-to-multi-servers%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

















draft saved

draft discarded



















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f541106%2fssh-to-multi-servers%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...