how to decrease ssh connection timeout value [closed] - bash

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have a list of full remote host ip addresses. I wrote a script to connect all the hosts in this list, one by one. My question is, sometimes when an IP address is down, script waits for a while (maybe a couple of minute) to go and execute next host. So I would like to decrease this waiting time. For example after 10 s, I want ssh connection is timeout and my script tries the next IP address. So how I can tweak this?
Thanks

if you call ssh script you can use something like that
ssh -o ConnectTimeout=10 <hostName>
where 10 is the number of seconds

Related

How to restrict bypassing bash ssh tunnel [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I am using SSH to exchange some keys between my server and a client.
Here the client should use SSH to send me his public key; my question is, how to restrict the other commands in bash?
Even if I use rbash, the client can run commands like:
ssh remote_host command_to_run
What can I do to overcome this problem?
Are you trying to authorize only one command on the server when a particular SSH key is used ? If yes, you can check the command statement of the authorized_keys file.
For example to authorize only ps -aux when the user foobar use KEY, you can edit /home/foobar/.ssh/authorized_keys this way :
command="ps -aux" ssh-rsa KEY
See the manual.
Please have a look at sshd_config on your (server) machine.
"Match" and "ForceCommand" should provide you with means for
restricting the commands available (or which command(s) to execute on connect).
You might also consider allowing only scp (to a specific directory)
and pickup the files from a daemon (or cron job) on the server.

Mikrotik - How to add Simple Load Balancing in Mikrotik [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I have to WAN connected to mikrotik routerboard, named ppoe-WAN1 and ppoe-WAN2
I want to add simple load balancing to using tow internet connection for all lan users
the simplest way is that add new route with 2 gateway like image below,
Note that if before add this route you must delete all route with distance 1 that does not contains routing marks
and disable Add default Route from pope connections
Having two gateways for the same destination will just put the other in redundancy. It is better that you decide on one of the following:
1. Policy based routing (PBR)
2. Per connection classifier (PCC)

How to quickly check if a private rsa key still works for a bunch of servers in bash? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I have a list of many servers. need to check (actually do some works on them) if the private key on the hand still can be used to login with SSH.
If I use ssh -i /path/to/private_key admin#server_host. it will just hang there asking for password: admin#server_host's password:
What can I do to avoid this kind of hang, and collect info when private key is not applicable for this server?
You can tell ssh to not allow password authentication using:
ssh -i /path/to/private_key -oPasswordAuthentication=no admin#server_host
This will cause ssh to exit immediately if the private key does not work.
If you would like it to just exit if it is successful also, just add that command to the end:
ssh -i /path/to/private_key -oPasswordAuthentication=no admin#server_host exit
I couldn't get the PasswordAuthentication=no option to work with Mac OS/X 10.9.2.
However, I was able to get the desired behavior with NumberOfPasswordPrompts=0.
Actually I find another more accurate option available in ssh which can be used to solve my problem.
-oPreferredAuthentications="publickey"
After add this option, ssh connection will only use authentication with the private key I provided instead of trying other methods first (and ruled out password like the answer I accepted). This even speed up whole process.

pointing cPanel to heroku [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Improve this question
I want to point my custom domain to heroku.
My provider uses cPanel.
I have followed the instructions here.
https://devcenter.heroku.com/articles/custom-domains
And added this to my DNS Zone Editor
www.my-site.com. 14400 IN CNAME my-app.herokuapp.com
however it's been a day and my app still doesn't point to heroku.
It might be because there are several other records in the DNS
currently these are the records in my DNS.
I'm wondering what's wrong with my setup.
Do I have to remove the A record pointing to the IP address of the old server?
note: XX.XX.XX.XX = Old IP address
NAME----------------------------TTL-----------CLASS------TYPE--------RECORD
my-site.com.---------------------14400-----------IN------------A----------XX.XX.XX.XX
localhost.my-site.com.---------14400-----------IN------------A------------127.0.0.1
mail.my-site.com.---------------14400-----------IN-----------CNAME-----my-site.com
www.my-site.com.--------------14400 ------ ----IN---------- CNAME-----my-app.herokuapp.com
ftp.my-site.com.---------------- 14400------------IN----------CNAME-----my-site.com
webdisk.my-site.com.----------14400----------- IN----------A-------------XX.XX.XX.XX
autodiscover.my-site.com.--- 14400------------IN----------A-------------XX.XX.XX.XX
autoconfig.my-site.com.------14400------------ IN----------A-------------XX.XX.XX.XX
FIX: I fixed the problem by removing the A record pointing to the old server. Then it now points to my herokuapp. I tried to put the old A record back on and it still works now (don't know why) maybe it's a conflict on the provider's side

How to configure user specific hosts file on Windows [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
There is Windows Server 2003 machine which has many users to access. Each of them want to configure their own hosts file to redirect a hostname to certain IP address. (They are virtual machines with same hostname and different IP addresses owned by each user.)
C:\WINDOWS\system32\drivers\etc\hosts
Also, we cannot simply ask users to use IP address to connect because the hostname is configured and need to be used in an application. Can we have this user specific hosts file configured or any workaround?
technically this is not possible...a simple programmatic work around could be to write a script and at user logon replace the file with whatever values you want.
since most of the changes in the hosts file are read at runtime, you should be able to achieve the result you are expecting

Resources