Changing listening ports with openSSH












2















i recently decided to turn my old desktop pc into a linux server where i can host my files etc. I followed a tutorial which used openssh and after installing it and configuring some files it works like a charm. I have a few questions though: the tutorial i followed here uses nc -v -z [addr] [port] to check if the ssh service is working on that port. However, no matter which port i use in the sshd_config file, it won't successfully listen on that port. Any ideas why?



PS: i'm a complete beginner to linux :)



*Running on Ubuntu 18.04LTS










share|improve this question























  • Are you running the nc command with the loopback address 127.0.0.1 as shown in the guide you linked? from where are you running the command?

    – steeldriver
    Feb 21 at 1:31











  • @steeldriver no,I'm using the local one and I'm running it from /home

    – Stelios Papamichail
    Feb 21 at 1:42
















2















i recently decided to turn my old desktop pc into a linux server where i can host my files etc. I followed a tutorial which used openssh and after installing it and configuring some files it works like a charm. I have a few questions though: the tutorial i followed here uses nc -v -z [addr] [port] to check if the ssh service is working on that port. However, no matter which port i use in the sshd_config file, it won't successfully listen on that port. Any ideas why?



PS: i'm a complete beginner to linux :)



*Running on Ubuntu 18.04LTS










share|improve this question























  • Are you running the nc command with the loopback address 127.0.0.1 as shown in the guide you linked? from where are you running the command?

    – steeldriver
    Feb 21 at 1:31











  • @steeldriver no,I'm using the local one and I'm running it from /home

    – Stelios Papamichail
    Feb 21 at 1:42














2












2








2








i recently decided to turn my old desktop pc into a linux server where i can host my files etc. I followed a tutorial which used openssh and after installing it and configuring some files it works like a charm. I have a few questions though: the tutorial i followed here uses nc -v -z [addr] [port] to check if the ssh service is working on that port. However, no matter which port i use in the sshd_config file, it won't successfully listen on that port. Any ideas why?



PS: i'm a complete beginner to linux :)



*Running on Ubuntu 18.04LTS










share|improve this question














i recently decided to turn my old desktop pc into a linux server where i can host my files etc. I followed a tutorial which used openssh and after installing it and configuring some files it works like a charm. I have a few questions though: the tutorial i followed here uses nc -v -z [addr] [port] to check if the ssh service is working on that port. However, no matter which port i use in the sshd_config file, it won't successfully listen on that port. Any ideas why?



PS: i'm a complete beginner to linux :)



*Running on Ubuntu 18.04LTS







networking server ssh






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 21 at 1:18









Stelios PapamichailStelios Papamichail

1134




1134













  • Are you running the nc command with the loopback address 127.0.0.1 as shown in the guide you linked? from where are you running the command?

    – steeldriver
    Feb 21 at 1:31











  • @steeldriver no,I'm using the local one and I'm running it from /home

    – Stelios Papamichail
    Feb 21 at 1:42



















  • Are you running the nc command with the loopback address 127.0.0.1 as shown in the guide you linked? from where are you running the command?

    – steeldriver
    Feb 21 at 1:31











  • @steeldriver no,I'm using the local one and I'm running it from /home

    – Stelios Papamichail
    Feb 21 at 1:42

















Are you running the nc command with the loopback address 127.0.0.1 as shown in the guide you linked? from where are you running the command?

– steeldriver
Feb 21 at 1:31





Are you running the nc command with the loopback address 127.0.0.1 as shown in the guide you linked? from where are you running the command?

– steeldriver
Feb 21 at 1:31













@steeldriver no,I'm using the local one and I'm running it from /home

– Stelios Papamichail
Feb 21 at 1:42





@steeldriver no,I'm using the local one and I'm running it from /home

– Stelios Papamichail
Feb 21 at 1:42










1 Answer
1






active

oldest

votes


















1














sshd, the ssh server, reads its config file (/etc/ssh/sshd_config) on sshd startup.



sudo service sshd restart


is one way to make this happen.






share|improve this answer


























  • No, it will not. It will cause it to no longer accept new sessions on the old port, but existing sessions will be allowed to proceed.

    – Wouter Verhelst
    Feb 21 at 9:01











  • So should i try this or is it "dangerous"?

    – Stelios Papamichail
    Feb 22 at 12:54











  • You should try it. What makes you think it's "dangerous"? You can see which port sshd is listening to by sudo lsof -c sshd -a -i

    – waltinator
    Feb 22 at 14:54












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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1119981%2fchanging-listening-ports-with-openssh%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














sshd, the ssh server, reads its config file (/etc/ssh/sshd_config) on sshd startup.



sudo service sshd restart


is one way to make this happen.






share|improve this answer


























  • No, it will not. It will cause it to no longer accept new sessions on the old port, but existing sessions will be allowed to proceed.

    – Wouter Verhelst
    Feb 21 at 9:01











  • So should i try this or is it "dangerous"?

    – Stelios Papamichail
    Feb 22 at 12:54











  • You should try it. What makes you think it's "dangerous"? You can see which port sshd is listening to by sudo lsof -c sshd -a -i

    – waltinator
    Feb 22 at 14:54
















1














sshd, the ssh server, reads its config file (/etc/ssh/sshd_config) on sshd startup.



sudo service sshd restart


is one way to make this happen.






share|improve this answer


























  • No, it will not. It will cause it to no longer accept new sessions on the old port, but existing sessions will be allowed to proceed.

    – Wouter Verhelst
    Feb 21 at 9:01











  • So should i try this or is it "dangerous"?

    – Stelios Papamichail
    Feb 22 at 12:54











  • You should try it. What makes you think it's "dangerous"? You can see which port sshd is listening to by sudo lsof -c sshd -a -i

    – waltinator
    Feb 22 at 14:54














1












1








1







sshd, the ssh server, reads its config file (/etc/ssh/sshd_config) on sshd startup.



sudo service sshd restart


is one way to make this happen.






share|improve this answer















sshd, the ssh server, reads its config file (/etc/ssh/sshd_config) on sshd startup.



sudo service sshd restart


is one way to make this happen.







share|improve this answer














share|improve this answer



share|improve this answer








edited Feb 22 at 14:52

























answered Feb 21 at 1:49









waltinatorwaltinator

22.9k74169




22.9k74169













  • No, it will not. It will cause it to no longer accept new sessions on the old port, but existing sessions will be allowed to proceed.

    – Wouter Verhelst
    Feb 21 at 9:01











  • So should i try this or is it "dangerous"?

    – Stelios Papamichail
    Feb 22 at 12:54











  • You should try it. What makes you think it's "dangerous"? You can see which port sshd is listening to by sudo lsof -c sshd -a -i

    – waltinator
    Feb 22 at 14:54



















  • No, it will not. It will cause it to no longer accept new sessions on the old port, but existing sessions will be allowed to proceed.

    – Wouter Verhelst
    Feb 21 at 9:01











  • So should i try this or is it "dangerous"?

    – Stelios Papamichail
    Feb 22 at 12:54











  • You should try it. What makes you think it's "dangerous"? You can see which port sshd is listening to by sudo lsof -c sshd -a -i

    – waltinator
    Feb 22 at 14:54

















No, it will not. It will cause it to no longer accept new sessions on the old port, but existing sessions will be allowed to proceed.

– Wouter Verhelst
Feb 21 at 9:01





No, it will not. It will cause it to no longer accept new sessions on the old port, but existing sessions will be allowed to proceed.

– Wouter Verhelst
Feb 21 at 9:01













So should i try this or is it "dangerous"?

– Stelios Papamichail
Feb 22 at 12:54





So should i try this or is it "dangerous"?

– Stelios Papamichail
Feb 22 at 12:54













You should try it. What makes you think it's "dangerous"? You can see which port sshd is listening to by sudo lsof -c sshd -a -i

– waltinator
Feb 22 at 14:54





You should try it. What makes you think it's "dangerous"? You can see which port sshd is listening to by sudo lsof -c sshd -a -i

– waltinator
Feb 22 at 14:54


















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1119981%2fchanging-listening-ports-with-openssh%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

is 'sed' thread safe

How to make a Squid Proxy server?