ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I used this code to ssh some IPs so that after any ssh and doing my commands I can ssh another IP.
Code:
while read IP
do
ssh -n $usr@$IP
done <IPvar
It is able to ssh but it exit immediately! and the error is shown:
stdin: is not a tty
Pseudo-terminal will not be allocated because stdin is not a terminal.
Well, you're using -n which teels ssh to go to the background (this doesn't work with passwords).. A great way is to use -f instead.. But in your situation, I wouldn't recommend any of them..
Well, you're using -n which teels ssh to go to the background (this doesn't work with passwords).. A great way is to use -f instead.. But in your situation, I wouldn't recommend any of them..
I used -f and the error was shown:
Cannot fork into background without a command to execute.
Yes, well, reading about the -f option was implied (I guess you did know what -n does!? don't you) .. Anyway, just don't use any options and it should work..
Yes, well, reading about the -f option was implied (I guess you did know what -n does!? don't you) .. Anyway, just don't use any options and it should work..
The error is shown:
stdin: is not a tty
and I can't run my commands
How do you run your script? Make sure you do it from a console (/emulator)... Since it needs to ask your password, you need an actual console (that's what tty means)
How do you run your script? Make sure you do it from a console (/emulator)... Since it needs to ask your password, you need an actual console (that's what tty means)
I used this code to ssh some IPs so that after any ssh and doing my commands I can ssh another IP.
Your scripting skills don't seem to trump OTS tools dealing with ^whatever.on.*multiple hosts already in terms of dependability, efficiency, versatility so unless wheel reinvention is your thing you might want to look at like ClusterSSH, Dsh, Fanout / Fanterm, Tentakel, Shocto, SwitchTower, MUC, Parallel SSH, RGANG and such.
Your scripting skills don't seem to trump OTS tools dealing with ^whatever.on.*multiple hosts already in terms of dependability, efficiency, versatility so unless wheel reinvention is your thing you might want to look at like ClusterSSH, Dsh, Fanout / Fanterm, Tentakel, Shocto, SwitchTower, MUC, Parallel SSH, RGANG and such.
I don't want to run the same command on them, I only need to access them one by one!
# User: exit
# IP:
ssh: Could not resolve hostname : No address associated with hostname
Gives you some nice prompts as well
So what you can do is put whatever user/IP required to login then it will prompt with pass. Access box do whatever you want and on exit will be presented with user/IP selection again.
Seems a bit pointless as you are still typing the user/IP anyway it would take just as long to type unless you are automating passing in usr/IP:
ssh root@some_ip
Could default input on the reads with -i if you always going in as root for instance.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.