Many corporate firewalls don't allow port 22 but do allow other ports (examples would be 21 and 80).  I've gotten tired of having to manually change my sshd_config and services files every time I reconfig at home...so I modified ssh-host-config to take an optional port assignment.  I have verified functionality on NT -- will check WindMill tonight.
 
Corinna -- would you consider adding this to the next release?  Thanks...
 
diff follows and modified ssh-newhost-config is attached:
 
18a19
> port_number=22
69a71,75
>   -p | --port )
>     port_number=$1
>     shift
>     ;;
>
78a85
>     echo "    --port   -p <n> sshd listens on port n."
275c282
< Port 22
---
> Port $port_number
328c335
< # Add port 22/tcp to services
---
> # Add port $port_number/tcp to services
345c352,368
< if [ `grep -q 'sshd[ \t][ \t]*22' "${_services}"; echo $?` -ne 0 ]
---
> cat > /tmp/sshd_awk.$$ << EOF
> \$1 == "sshd" { next }
> ! finished && \$2 + 0 >= $port_number {
>   finished = 1
>   if ( \$2 + 0 == $port_number ) {
>     # Problem -- non-sshd port assignment already exists.
>   } else {
>     print "sshd               $port_number/tcp                           #SSH daemon\r"
>   }
> }
> { print \$0 }
> EOF
>
> awk -f /tmp/sshd_awk.$$ < "${_services}" > "${_serv_tmp}"
> rm -f /tmp/sshd_awk.$$
>
> if [ -f "${_serv_tmp}" ]
347,348c370
<   awk '{ if ( $2 ~ /^23\/tcp/ ) print "sshd               22/tcp                           #SSH daemon\r"; print $0; }' < "${_services}" > "${_serv_tmp}"
<   if [ -f "${_serv_tmp}" ]
---
>   if [ `egrep -q '^sshd[ \t]' "${_serv_tmp}"; echo $?` -ne 0 ]
349a372,373
>     echo "Unable to add sshd to ${_services} as port $port_number already in use"
>   else
357,358d380
<   else
<     echo "Adding sshd to ${_services} failed\!"
359a382,383
> else
>   echo "Adding sshd to ${_services} failed\!"

ssh-newhost-config

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

Reply via email to