?
Solved

moving ssh port to 23

Posted on 2005-04-27
16
Medium Priority
?
497 Views
Last Modified: 2012-08-13
Hi,
At work we have some machines that have port 22 blocked but telnet works on 23.  So, what's the best way to change ssh's port and stop telnet and ftp?
Thanks.
0
Comment
Question by:mbpssgms
  • 6
  • 5
  • 3
  • +2
16 Comments
 
LVL 88

Accepted Solution

by:
rindi earned 800 total points
ID: 13875198
Look for the config file, probably in /etc/ssh with the name sshd_config. Look for an entry "port 22" and change that to the port you want. If you don't want the ftp or telnet daemons starting, look for the telnet and ftp startup programs in /etc/init.d, or /etc/rc3.d and /etc/rc5.d, and delete those entries there, or use the webmin tool, a webbrowser based interface for managing linux PCs. This is very simple to use and lets you manage a lot of services and programs in linux.

http://webmin.com

0
 

Author Comment

by:mbpssgms
ID: 13875730
Yes, I have already altered the ssh conf file but that is where I thought I was missing something since it still uses port 22.
Thanks,
gs
0
 
LVL 34

Expert Comment

by:PsiCop
ID: 13875832
Note that you have to kill telnet *before* the SSH daemon will be able to listen on port 23.

Alter sshd_config to determine the port that the SSH daemon listens on. Then send the deamon a SIGHUP or restart it.
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
LVL 88

Expert Comment

by:rindi
ID: 13875948
Or just restart the PC...
0
 

Author Comment

by:mbpssgms
ID: 13876104
Sorry but I'm having probs. stopping telnet it's not in rc3.d or init.d.
0
 
LVL 88

Expert Comment

by:rindi
ID: 13876145
Check with webmin, it may have a different filename than telnet...
0
 

Author Comment

by:mbpssgms
ID: 13877792
Hi,

The box with in question is running jobs until weekend, I'll reboot then
thanks.
0
 
LVL 34

Expert Comment

by:PsiCop
ID: 13878301
Also, telnet may be launched as part of inetd, in which case you need to modify inetd.conf (dunno your distro, so I can't say where that lives).
0
 
LVL 88

Expert Comment

by:rindi
ID: 13878521
Also depending on your distro, you may use your paket manager or other software installation tool to uninstall telnet (after all, there should not be any need for it). If you use that tool, it should also be removed from your startup and probably also will stop running after the deinstallation, without the need to reboot...
0
 
LVL 48

Expert Comment

by:Tintin
ID: 13881349
When you are trying to connect, you are using:

ssh -p 23 hostname

aren't you?

0
 

Author Comment

by:mbpssgms
ID: 13884263
Hi,
I have just tried the -p argument and it was trying to connect for abt 10min before I stopped it.  

I cannot remove telnet since there are machines across the uni. that have it.  

Sorry for any delay in responding but I 'look after' the machines on a voluntary basis.  I am a Biochemist, with unix knowledge.

Thanks.
gs.

0
 
LVL 34

Expert Comment

by:PsiCop
ID: 13888974
Why have SSH when telnet is still in use? Doesn't make much sense.

You will not be able to get the SSH daemon to listen on Port 23 as long as the telnet daemon has bound it. Only one daemon can bind a port.
0
 
LVL 88

Expert Comment

by:rindi
ID: 13889292
You should ask the other way round, why have telnet if you can do it with ssh (and I'm sure every telnet can be replaced with ssh. As for clients, all ssh clients I know can also connect to telnet servers. But I strongly recommend to upgrade to SSH, as this is much more secure.
0
 

Author Comment

by:mbpssgms
ID: 13892702
Yes, indeed
I am in the progress of stopping all telnet and ftp use.  We have been plagued by hacks.  Whilst this may be fun and administer a sense of achievement for some.  It causes endless probs. here.  Annoyingly, I need to stop everything to fix.
Thanks
ps.
whilst ll the group are using telnet, I cannot stop it until weekend also.
gs.
0
 

Author Comment

by:mbpssgms
ID: 13900338
Yes, bingo.  I also tried this on Irix, no joy.  Now I'm locked out, any ideas?
gs
0
 
LVL 3

Expert Comment

by:sigel1
ID: 13941840
You could try rlogin?  Don't know if anyone even uses it anymore.  I suggest a keyboard, sorry.  There are some problems with using port 23.  I suggest you pick a random port number for SSH,  it prevents people from hacking into your comp who know the port number.  Setting it to 23 could cause SSH to crash if some new worm or virus attacks it, meant for telnet.  I suggest never use the real port to anything if it is avoidable.  You should also use real ssh since OpenSSH is insecure and badly written.  
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses
Course of the Month16 days, 13 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question