1

these are the steps I followed to change the default ssh port

  1. login to compute engine instance using gcutil ssh
  2. cd /etc/ssh
  3. sudo nano sshd_config --> changed the port to some number lets say for the example: 1111
  4. saved and exit
  5. sudo service ssh restart ---> [ ok ] Restarting OpenBSD Secure Shell server: sshd.
  6. open a new terminal and repeated step 1 ---> ssh: connect to host xxx.xxx.xxx.xxx port 22: Connection refused ----> the change succeded
  7. went to my GCE console and added a firewall with the tcp:1111
  8. tried to connect again with gcutil ssh ---> ssh: connect to host xxx.xxx.xxx.xxx port 22: Connection refused I'm not following why after enabling the port 1111 on the GCE gcutil ssh still tries to connect on port 22

    INFO: Running command line: ssh -o UserKnownHostsFile=/dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no -i /Users/MyUser/.ssh/google_compute_engine -A -p 22 [email protected] --

what am i missing? should I download my ssh key again after changing the port? and if so how do i do that?

3 Answers 3

2

The documentation clearly states how to provide an alternate ssh port for gcutil ssh.

  --ssh_port: TCP port to connect to
    (default: '22')
    (an integer)

in your case:

gcutil ssh --ssh_port=1111 <instance name>
4
  • 1
    why waist time writing an answer if you don't supply any useful data??? as mentioned above i DID change the ssh port but when trying to reconnect it fails so obviously the problem lies in the client side, but I don't know where to configure the ssh command to run with different port i can always connect with the full command: ssh -o UserKnownHostsFile=/dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no -i /Users/Kukula/.ssh/google_compute_engine -A -p 1111 [email protected] but that is not what i'm asking so if you do know the answer and willing to share i'd appreciate it Feb 17, 2014 at 8:42
  • Your question never mentioned that you did this - and it still doesn't. If you actually did, then you need to edit your question. Feb 17, 2014 at 14:27
  • I suggest you first read what i wrote step 6 states : The change succeeded, before being condescending! Feb 18, 2014 at 11:17
  • @KukulaMula No one is being condescending here. We are trying to help you. AGAIN, you need to edit your question. Feb 18, 2014 at 12:58
0

Faced the same problem, still don't know which file to change inorder for the standart gcutil ssh <machine_name> to call the new port in your case 1111, @Michael Hampton answer was correct, but he didn't wrapped it within the entire command which confused you so try the following command i believe it will work and you'll be able to connect with your instance

gcutil ssh --ssh_port 1111 <machine_name>

0

ssh -o UserKnownHostsFile=/dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no -i /Users/MyUser/.ssh/google_compute_engine -A -p 22 [email protected]

That "-p 22" tells the ssh command to try to connect to a server on port 22. Change the 22 to the port you have your server running on and you should be good to go.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .