Menu

#1 change port for ssh

open
nobody
None
5
2007-08-23
2007-08-23
nethope
No

I'd like to be able to specify a non-standard port for ssh to use within sssh. (Like I assume most other Linux users, I use a different port for ssh so I don't have to read about failed attempts in syslog/LogWatch/whatever.)

30,31c30,31
< Usage: $0 -f <farm1>[,..,<farmN>] [-l <user>] -c "<command>"
< $0 -H <host1>[,<host2>,..] [-l <user>] -c "<command>"
---
> Usage: $0 -f <farm1>[,..,<farmN>] [-l <user>] [-p <port>] -c "<command>"
> $0 -H <host1>[,<host2>,..] [-l <user>] [-p <port>] -c "<command>"
49a50
> -p port Use this alternate ssh port
65c66
< while getopts Ac:C:f:hH:Ll:x:qt opt
---
> while getopts Ac:C:f:hH:Ll:p:qtx: opt
76a78
> p) PORT="-p "$OPTARG ;;
112c114
< /usr/bin/ssh $SSH_OPTS $user@$ip "$cmd"
---
> /usr/bin/ssh $SSH_OPTS $PORT $user@$ip "$cmd"

This version (the above changes) is working for me, both to machines where I use -p and machines where I don't.

Discussion

  • nethope

    nethope - 2007-08-23

    Logged In: YES
    user_id=1685241
    Originator: YES

    This also requires an update to sssh_funcs ...

    118c118
    < ssh $SSH_OPTS $PORT $user@$ip "sh -c '\ ---
    > ssh $SSH_OPTS $user@$ip "sh -c '\

     
  • nethope

    nethope - 2007-08-23

    Logged In: YES
    user_id=1685241
    Originator: YES

    ... and of course an update to sscp as well (this is the only fix here that I haven't tested myself) ...

    58c58
    < while getopts ApghH:qLtc:f:l:x: opt
    ---
    > while getopts Ac:f:ghH:l:LpP:qtx: opt
    61a62
    > c) ;;
    63,64c64
    < l) user=$OPTARG ;;
    < p) push=1 ;;
    ---
    > g) get=1 ;;
    68c68,71
    < g) get=1 ;;
    ---
    > l) user=$OPTARG ;;
    > L) list=1 ;;
    > p) push=1 ;;
    > P) PORT="-P "$OPTARG ;;
    69a73
    > t) ;;
    71d74
    < L) list=1 ;;
    123c126
    < /usr/bin/scp -r $SSH_OPTS $srcfile $user@$ip:$dstfile
    ---
    > /usr/bin/scp -r $SSH_OPTS $PORT $srcfile $user@$ip:$dstfile
    131c134
    < /usr/bin/scp -r $SSH_OPTS $user@$ip:$srcfile $dstfile.$ip
    ---
    > /usr/bin/scp -r $SSH_OPTS $PORT $user@$ip:$srcfile $dstfile.$ip

     

Log in to post a comment.