B
B
BlagoYar Silence2021-03-03 23:20:38
SSH
BlagoYar Silence, 2021-03-03 23:20:38

How to set port in ssh command parameters?

I set up access by key, disabled it by password, changed the standard port 22 to my own.
I set up port knocking
. And when I try to log in to the local host
ssh 192.168.0.100 -l root
, the connection error says that it is trying to do this on port 22, and not on the one that I changed.

PS. When the iptables deny rule is removed, the connection proceeds normally.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Belyaev, 2021-03-03
@BlagoYar

For the ssh command - the -p flag and port: For scp - the -P (capital) flag and port: For rsync - through the -e flag, you can specify a custom shell, respectively, we give ssh there with the -p flag: UPD: In addition, you can in the folder ~/.ssh (where the keys are) create a file called config (without extension) and set aliases and many settings for the necessary hosts, including the port, default user and alternative key, after which it will be possible to write only an alias in all ssh utilities: Documentation on available options Plugin for vscode for highlighting and auto-completion in ~/.ssh/config file ssh -p 2222 [email protected]
ssh alias

S
Sergey Mukhin, 2021-03-03
@mukhindev

Flag-p номер_порта

D
Dmitry, 2021-03-03
@Tabletko

man ssh
flag-p

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question