Posts

Showing posts with the label ssh

[ Level 2 ] Connect pool for ssh.

If you want to use the concept "connection pool" for ssh, you could try the following sample. #!/bin/bash # # You might need to modify sshd_config with the following attributes: # # MaxStartup 200 # MaxSessions 200 # [ "$1" == "-d" ] && set -vx && shift control_master="$1" && [ "$control_master" != "false" ] && control_master=true username="$2" && [ -z $username ] && username=stanley remote_host="$3" && [ -z $remote_host ] && remote_host=127.0.0.1 cmd1="$4"&& [ -z $cmd1 ] && cmd1=ls control_master_option="" client_cmd="/tmp/a.sh" buildControlMaster() { if $control_master then ssh -N -o "ControlMaster auto" -o "ControlPath ~/.ssh/master-$username@$remote_host" $username@$remote_host & fi } createClientCmd() { mkdir -p /tmp/add rm /tmp/add/* $client_cmd if $c...

[Level 1] Restrict user login in ssh.

You can use AllowUsers/AllowGroups/DenyUsers/DenyGroups in sshd_config to limit user login. e.g. # cat /etc/ssh/sshd_config AllowUsers user1 AllowGroups group1 DenyUsers user2 DenyGroups group2 Wish this helps. regards, Stanley Huang

[Level 2] How to skip StrictHostKeyChecking in ssh.

If you want to ignore strict host key checking, even skip saving the host key info, you could use option UserKnownHostsFile, StrictHostKeyChecking. Ex. ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no stanley@192.168.1.1 or modify /etc/ssh/ssh_config for global settings. # cat /etc/ssh/ssh_config ... UserKnownHostsFile /dev/null StrictHostKeyChecking no ... Wish this helps. regards, Stanley Huang