Can not change ssh port | Server 16.04Not able to change ssh port on Ubuntu 18.04.1 LTSOpenVPN working when...
“I had a flat in the centre of town, but I didn’t like living there, so …”
Why would the IRS ask for birth certificates or even audit a small tax return?
Why are special aircraft used for the carriers in the United States Navy?
How can I handle a player who pre-plans arguments about my rulings on RAW?
Why doesn't "adolescent" take any articles in "listen to adolescent agonising"?
Lock enemy's y-axis when using Vector3.MoveTowards to follow the player
School performs periodic password audits. Is my password compromised?
Formatting a table to look nice
Is there a math equivalent to the conditional ternary operator?
Is there any relevance to Thor getting his hair cut other than comedic value?
Why do phishing e-mails use faked e-mail addresses instead of the real one?
How to mitigate "bandwagon attacking" from players?
Misplaced tyre lever - alternatives?
I've given my players a lot of magic items. Is it reasonable for me to give them harder encounters?
How to get the first element while continue streaming?
3.5% Interest Student Loan or use all of my savings on Tuition?
Did Amazon pay $0 in taxes last year?
What is a term for a function that when called repeatedly, has the same effect as calling once?
Giving a talk in my old university, how prominently should I tell students my salary?
Are small insurances worth it
I encountered my boss during an on-site interview at another company. Should I bring it up when seeing him next time?
Is divide-by-zero a security vulnerability?
Can a Trickery Domain cleric cast a spell through the Invoke Duplicity clone while inside a Forcecage?
How does insurance birth control work?
Can not change ssh port | Server 16.04
Not able to change ssh port on Ubuntu 18.04.1 LTSOpenVPN working when started from CLI, but not when started using init.d script on bootSSH not workingCannot SSH into server using non standard portmy local cisco devices to backup on my local lappy as tftp server in Ubuntu 16.04Unable to install docker - invoke-rc.d: initscript docker, action “start” failedPutty: Can't SSH into port 53425 instead of 22?Problem with SANEssh not connectingTrouble accessing Ubuntu server with SSHNot able to change ssh port on Ubuntu 18.04.1 LTS
I want to change the ssh port from 22 to 2800. I tried to change the /etc/ssh/ssh_config
and removed the # from Port line and changed the number to 2800. after trigger the command: service ssh restart
The connection continued. When I tried to connect from the port 2800, It refused.
The Content of /etc/ssh/ssh_config
is: Removed commented lines
Host *
Port 2800
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes
GSSAPIDelegateCredentials no
The command service ssh status
gives the following output:
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2017-09-22 20:31:45 IRST; 1s ago
Main PID: 1825 (sshd)
Tasks: 1
Memory: 724.0K
CPU: 5ms
CGroup: /system.slice/ssh.service
└─1825 /usr/sbin/sshd -D
Sep 22 20:31:45 GoodMind systemd[1]: Starting OpenBSD Secure Shell server...
Sep 22 20:31:45 GoodMind sshd[1825]: Server listening on 0.0.0.0 port 22.
Sep 22 20:31:45 GoodMind sshd[1825]: Server listening on :: port 22.
Sep 22 20:31:45 GoodMind systemd[1]: Started OpenBSD Secure Shell server.
I tried other ports too. But still it has the same status. What do I do wrong?
networking server ssh
add a comment |
I want to change the ssh port from 22 to 2800. I tried to change the /etc/ssh/ssh_config
and removed the # from Port line and changed the number to 2800. after trigger the command: service ssh restart
The connection continued. When I tried to connect from the port 2800, It refused.
The Content of /etc/ssh/ssh_config
is: Removed commented lines
Host *
Port 2800
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes
GSSAPIDelegateCredentials no
The command service ssh status
gives the following output:
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2017-09-22 20:31:45 IRST; 1s ago
Main PID: 1825 (sshd)
Tasks: 1
Memory: 724.0K
CPU: 5ms
CGroup: /system.slice/ssh.service
└─1825 /usr/sbin/sshd -D
Sep 22 20:31:45 GoodMind systemd[1]: Starting OpenBSD Secure Shell server...
Sep 22 20:31:45 GoodMind sshd[1825]: Server listening on 0.0.0.0 port 22.
Sep 22 20:31:45 GoodMind sshd[1825]: Server listening on :: port 22.
Sep 22 20:31:45 GoodMind systemd[1]: Started OpenBSD Secure Shell server.
I tried other ports too. But still it has the same status. What do I do wrong?
networking server ssh
1
FWIW, IMO changing the port adds little to security as all the cracking tools can recognize ssh listening regardless of port. It may quiet the logs a bit, but, IMO, there are better methods of quieting the logs. Also changing the port is a bit of a pain as you then have to configure or specify the port when you connect. If you are the only user perhaps no big deal but if multiple users are connecting it becomes a pain to have to use a different port with every server. I suggest keys and some other tips here - bodhizazen.com/Tutorials/SSH_security
– Panther
Sep 22 '17 at 17:27
add a comment |
I want to change the ssh port from 22 to 2800. I tried to change the /etc/ssh/ssh_config
and removed the # from Port line and changed the number to 2800. after trigger the command: service ssh restart
The connection continued. When I tried to connect from the port 2800, It refused.
The Content of /etc/ssh/ssh_config
is: Removed commented lines
Host *
Port 2800
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes
GSSAPIDelegateCredentials no
The command service ssh status
gives the following output:
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2017-09-22 20:31:45 IRST; 1s ago
Main PID: 1825 (sshd)
Tasks: 1
Memory: 724.0K
CPU: 5ms
CGroup: /system.slice/ssh.service
└─1825 /usr/sbin/sshd -D
Sep 22 20:31:45 GoodMind systemd[1]: Starting OpenBSD Secure Shell server...
Sep 22 20:31:45 GoodMind sshd[1825]: Server listening on 0.0.0.0 port 22.
Sep 22 20:31:45 GoodMind sshd[1825]: Server listening on :: port 22.
Sep 22 20:31:45 GoodMind systemd[1]: Started OpenBSD Secure Shell server.
I tried other ports too. But still it has the same status. What do I do wrong?
networking server ssh
I want to change the ssh port from 22 to 2800. I tried to change the /etc/ssh/ssh_config
and removed the # from Port line and changed the number to 2800. after trigger the command: service ssh restart
The connection continued. When I tried to connect from the port 2800, It refused.
The Content of /etc/ssh/ssh_config
is: Removed commented lines
Host *
Port 2800
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes
GSSAPIDelegateCredentials no
The command service ssh status
gives the following output:
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2017-09-22 20:31:45 IRST; 1s ago
Main PID: 1825 (sshd)
Tasks: 1
Memory: 724.0K
CPU: 5ms
CGroup: /system.slice/ssh.service
└─1825 /usr/sbin/sshd -D
Sep 22 20:31:45 GoodMind systemd[1]: Starting OpenBSD Secure Shell server...
Sep 22 20:31:45 GoodMind sshd[1825]: Server listening on 0.0.0.0 port 22.
Sep 22 20:31:45 GoodMind sshd[1825]: Server listening on :: port 22.
Sep 22 20:31:45 GoodMind systemd[1]: Started OpenBSD Secure Shell server.
I tried other ports too. But still it has the same status. What do I do wrong?
networking server ssh
networking server ssh
asked Sep 22 '17 at 17:04
Mohammad EtemaddarMohammad Etemaddar
5031822
5031822
1
FWIW, IMO changing the port adds little to security as all the cracking tools can recognize ssh listening regardless of port. It may quiet the logs a bit, but, IMO, there are better methods of quieting the logs. Also changing the port is a bit of a pain as you then have to configure or specify the port when you connect. If you are the only user perhaps no big deal but if multiple users are connecting it becomes a pain to have to use a different port with every server. I suggest keys and some other tips here - bodhizazen.com/Tutorials/SSH_security
– Panther
Sep 22 '17 at 17:27
add a comment |
1
FWIW, IMO changing the port adds little to security as all the cracking tools can recognize ssh listening regardless of port. It may quiet the logs a bit, but, IMO, there are better methods of quieting the logs. Also changing the port is a bit of a pain as you then have to configure or specify the port when you connect. If you are the only user perhaps no big deal but if multiple users are connecting it becomes a pain to have to use a different port with every server. I suggest keys and some other tips here - bodhizazen.com/Tutorials/SSH_security
– Panther
Sep 22 '17 at 17:27
1
1
FWIW, IMO changing the port adds little to security as all the cracking tools can recognize ssh listening regardless of port. It may quiet the logs a bit, but, IMO, there are better methods of quieting the logs. Also changing the port is a bit of a pain as you then have to configure or specify the port when you connect. If you are the only user perhaps no big deal but if multiple users are connecting it becomes a pain to have to use a different port with every server. I suggest keys and some other tips here - bodhizazen.com/Tutorials/SSH_security
– Panther
Sep 22 '17 at 17:27
FWIW, IMO changing the port adds little to security as all the cracking tools can recognize ssh listening regardless of port. It may quiet the logs a bit, but, IMO, there are better methods of quieting the logs. Also changing the port is a bit of a pain as you then have to configure or specify the port when you connect. If you are the only user perhaps no big deal but if multiple users are connecting it becomes a pain to have to use a different port with every server. I suggest keys and some other tips here - bodhizazen.com/Tutorials/SSH_security
– Panther
Sep 22 '17 at 17:27
add a comment |
3 Answers
3
active
oldest
votes
Changing the ssh port in not in the file /etc/ssh/ssh_config
but in /etc/ssh/sshd_config
(you miss the d after ssh meaning "daemon").
Just edit this change and change uncomment and update the line
#Port 22
Don't forget to restart your service as you done it with service ssh restart
.
Yes and restart the ssh server or reload the config after the edit.
– Panther
Sep 22 '17 at 17:33
1
Edited for those who want the complete process, thanks for the suggestion.
– olivierb2
Sep 22 '17 at 18:19
Unit ssh.service not found
– mrid
Sep 6 '18 at 10:33
add a comment |
Your settings are correct but you changed them in the wrong config file. It should be /etc/ssh/sshd_config
and you might want to restart the SSH service and open the new port your SSH Server is listening on.
To do this, run the following commands:
sudo service ssh restart
orsudo systemctl restart sshd.service
- Open the port on your firewall
sudo iptables -I INPUT -p tcp --dport 2800 -j ACCEPT
.
This should be all you need to accept connections on port 2800
. You can also check what ports your machine is listening on with netstat -lt4
and you should see a line similar to
tcp 0 0 *:2800 *:* LISTEN
Let me know if it works for you!
1
by default ubuntu is accepts all traffic and if one is using a firewall more likely than not it is ufw. Even if you run that command, it will not be preserved with a reboot. To do that you would need to use iptables-persistent or configure iptables - thomas-krenn.com/en/wiki/…
– Panther
Sep 22 '17 at 17:24
add a comment |
at least on newer ubuntu server installations u need to add a ufw rule as well
sudo ufw allow 2800
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f958440%2fcan-not-change-ssh-port-server-16-04%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Changing the ssh port in not in the file /etc/ssh/ssh_config
but in /etc/ssh/sshd_config
(you miss the d after ssh meaning "daemon").
Just edit this change and change uncomment and update the line
#Port 22
Don't forget to restart your service as you done it with service ssh restart
.
Yes and restart the ssh server or reload the config after the edit.
– Panther
Sep 22 '17 at 17:33
1
Edited for those who want the complete process, thanks for the suggestion.
– olivierb2
Sep 22 '17 at 18:19
Unit ssh.service not found
– mrid
Sep 6 '18 at 10:33
add a comment |
Changing the ssh port in not in the file /etc/ssh/ssh_config
but in /etc/ssh/sshd_config
(you miss the d after ssh meaning "daemon").
Just edit this change and change uncomment and update the line
#Port 22
Don't forget to restart your service as you done it with service ssh restart
.
Yes and restart the ssh server or reload the config after the edit.
– Panther
Sep 22 '17 at 17:33
1
Edited for those who want the complete process, thanks for the suggestion.
– olivierb2
Sep 22 '17 at 18:19
Unit ssh.service not found
– mrid
Sep 6 '18 at 10:33
add a comment |
Changing the ssh port in not in the file /etc/ssh/ssh_config
but in /etc/ssh/sshd_config
(you miss the d after ssh meaning "daemon").
Just edit this change and change uncomment and update the line
#Port 22
Don't forget to restart your service as you done it with service ssh restart
.
Changing the ssh port in not in the file /etc/ssh/ssh_config
but in /etc/ssh/sshd_config
(you miss the d after ssh meaning "daemon").
Just edit this change and change uncomment and update the line
#Port 22
Don't forget to restart your service as you done it with service ssh restart
.
edited Sep 22 '17 at 18:18
answered Sep 22 '17 at 17:09
olivierb2olivierb2
1,98489
1,98489
Yes and restart the ssh server or reload the config after the edit.
– Panther
Sep 22 '17 at 17:33
1
Edited for those who want the complete process, thanks for the suggestion.
– olivierb2
Sep 22 '17 at 18:19
Unit ssh.service not found
– mrid
Sep 6 '18 at 10:33
add a comment |
Yes and restart the ssh server or reload the config after the edit.
– Panther
Sep 22 '17 at 17:33
1
Edited for those who want the complete process, thanks for the suggestion.
– olivierb2
Sep 22 '17 at 18:19
Unit ssh.service not found
– mrid
Sep 6 '18 at 10:33
Yes and restart the ssh server or reload the config after the edit.
– Panther
Sep 22 '17 at 17:33
Yes and restart the ssh server or reload the config after the edit.
– Panther
Sep 22 '17 at 17:33
1
1
Edited for those who want the complete process, thanks for the suggestion.
– olivierb2
Sep 22 '17 at 18:19
Edited for those who want the complete process, thanks for the suggestion.
– olivierb2
Sep 22 '17 at 18:19
Unit ssh.service not found
– mrid
Sep 6 '18 at 10:33
Unit ssh.service not found
– mrid
Sep 6 '18 at 10:33
add a comment |
Your settings are correct but you changed them in the wrong config file. It should be /etc/ssh/sshd_config
and you might want to restart the SSH service and open the new port your SSH Server is listening on.
To do this, run the following commands:
sudo service ssh restart
orsudo systemctl restart sshd.service
- Open the port on your firewall
sudo iptables -I INPUT -p tcp --dport 2800 -j ACCEPT
.
This should be all you need to accept connections on port 2800
. You can also check what ports your machine is listening on with netstat -lt4
and you should see a line similar to
tcp 0 0 *:2800 *:* LISTEN
Let me know if it works for you!
1
by default ubuntu is accepts all traffic and if one is using a firewall more likely than not it is ufw. Even if you run that command, it will not be preserved with a reboot. To do that you would need to use iptables-persistent or configure iptables - thomas-krenn.com/en/wiki/…
– Panther
Sep 22 '17 at 17:24
add a comment |
Your settings are correct but you changed them in the wrong config file. It should be /etc/ssh/sshd_config
and you might want to restart the SSH service and open the new port your SSH Server is listening on.
To do this, run the following commands:
sudo service ssh restart
orsudo systemctl restart sshd.service
- Open the port on your firewall
sudo iptables -I INPUT -p tcp --dport 2800 -j ACCEPT
.
This should be all you need to accept connections on port 2800
. You can also check what ports your machine is listening on with netstat -lt4
and you should see a line similar to
tcp 0 0 *:2800 *:* LISTEN
Let me know if it works for you!
1
by default ubuntu is accepts all traffic and if one is using a firewall more likely than not it is ufw. Even if you run that command, it will not be preserved with a reboot. To do that you would need to use iptables-persistent or configure iptables - thomas-krenn.com/en/wiki/…
– Panther
Sep 22 '17 at 17:24
add a comment |
Your settings are correct but you changed them in the wrong config file. It should be /etc/ssh/sshd_config
and you might want to restart the SSH service and open the new port your SSH Server is listening on.
To do this, run the following commands:
sudo service ssh restart
orsudo systemctl restart sshd.service
- Open the port on your firewall
sudo iptables -I INPUT -p tcp --dport 2800 -j ACCEPT
.
This should be all you need to accept connections on port 2800
. You can also check what ports your machine is listening on with netstat -lt4
and you should see a line similar to
tcp 0 0 *:2800 *:* LISTEN
Let me know if it works for you!
Your settings are correct but you changed them in the wrong config file. It should be /etc/ssh/sshd_config
and you might want to restart the SSH service and open the new port your SSH Server is listening on.
To do this, run the following commands:
sudo service ssh restart
orsudo systemctl restart sshd.service
- Open the port on your firewall
sudo iptables -I INPUT -p tcp --dport 2800 -j ACCEPT
.
This should be all you need to accept connections on port 2800
. You can also check what ports your machine is listening on with netstat -lt4
and you should see a line similar to
tcp 0 0 *:2800 *:* LISTEN
Let me know if it works for you!
edited Sep 22 '17 at 20:03
answered Sep 22 '17 at 17:10
xR34P3RxxR34P3Rx
24119
24119
1
by default ubuntu is accepts all traffic and if one is using a firewall more likely than not it is ufw. Even if you run that command, it will not be preserved with a reboot. To do that you would need to use iptables-persistent or configure iptables - thomas-krenn.com/en/wiki/…
– Panther
Sep 22 '17 at 17:24
add a comment |
1
by default ubuntu is accepts all traffic and if one is using a firewall more likely than not it is ufw. Even if you run that command, it will not be preserved with a reboot. To do that you would need to use iptables-persistent or configure iptables - thomas-krenn.com/en/wiki/…
– Panther
Sep 22 '17 at 17:24
1
1
by default ubuntu is accepts all traffic and if one is using a firewall more likely than not it is ufw. Even if you run that command, it will not be preserved with a reboot. To do that you would need to use iptables-persistent or configure iptables - thomas-krenn.com/en/wiki/…
– Panther
Sep 22 '17 at 17:24
by default ubuntu is accepts all traffic and if one is using a firewall more likely than not it is ufw. Even if you run that command, it will not be preserved with a reboot. To do that you would need to use iptables-persistent or configure iptables - thomas-krenn.com/en/wiki/…
– Panther
Sep 22 '17 at 17:24
add a comment |
at least on newer ubuntu server installations u need to add a ufw rule as well
sudo ufw allow 2800
New contributor
add a comment |
at least on newer ubuntu server installations u need to add a ufw rule as well
sudo ufw allow 2800
New contributor
add a comment |
at least on newer ubuntu server installations u need to add a ufw rule as well
sudo ufw allow 2800
New contributor
at least on newer ubuntu server installations u need to add a ufw rule as well
sudo ufw allow 2800
New contributor
New contributor
answered 1 min ago
Leo LegacyLeo Legacy
1
1
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f958440%2fcan-not-change-ssh-port-server-16-04%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
FWIW, IMO changing the port adds little to security as all the cracking tools can recognize ssh listening regardless of port. It may quiet the logs a bit, but, IMO, there are better methods of quieting the logs. Also changing the port is a bit of a pain as you then have to configure or specify the port when you connect. If you are the only user perhaps no big deal but if multiple users are connecting it becomes a pain to have to use a different port with every server. I suggest keys and some other tips here - bodhizazen.com/Tutorials/SSH_security
– Panther
Sep 22 '17 at 17:27