I'm working on aws cloud image which requires an ssh connection to connect. But my service provider has blocked the port 22 so I can't connect to cloud image. So how can I change Ssh configuration to change the port number from 22 to something other?
You say Windows 10 but of course Windows doesn't natively use ssh. Though you can install bash or some other shell via the Linux Subsystem for Windows. This, I trust, is what you mean. Here are some basic instructions for changing the file containing the port information:
1: find / -name "sshd_config" 2>/dev/null 2: sudo nano /path/to/file ## probably /etc/ssh/sshd_config 3: ## locate Port 22 (removing any leading #) 4: ctrl-o # save the file 5: ctrl-x # exit nano
Once you have changed it you simply add the port designation to your ssh command when attempting to connect.
(You may need to make firewall changes if there is one in between. It depends on the specifics of your arrangement.)
Nowadays, you can change the SSH port on Windows 10 easily (as mentioned by others).
All you need is in this Microsoft documentation page.
Brief look at:
- Install SSH server;
- Change port in config file
- Add new firewall
rule with PowerShell running following command as Administrator:
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 2204
- Restart your 'SSH server' windows service;
- (optional) Delete firewall rule for default