Lxw2015
Posts: 85
Joined: Fri Feb 12, 2016 4:05 am

telnet to Pi

Mon Dec 10, 2018 4:47 pm

I'm using 2018-11-13-raspbian-stretch-full.img
My linux PC connects to Pi via a switch. I can ping Pi. but when I telnet to Pi, got
Trying 192.168.1.101...
telnet: connect to address 192.168.1.101: Connection refused

search on web, then I enabled SSH on Pi with rasp-config

reboot Pi,

still can't telnet. please give me some clue.
thanks
LXW

scotty101
Posts: 4162
Joined: Fri Jun 08, 2012 6:03 pm

Re: telnet to Pi

Mon Dec 10, 2018 4:51 pm

Have you installed a telnetd on to your Pi? I don't think it installed by default since for most applications, people will use SSH.

SSH != Telnet.

What is your use case for using telnet rather than SSH?
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

tpyo kingg
Posts: 972
Joined: Mon Apr 09, 2018 5:26 pm
Location: N. Finland

Re: telnet to Pi

Mon Dec 10, 2018 4:55 pm

Try using the SSH client:

Code: Select all

ssh -l pi 192.168.1.101
Unlike Telnet, the SSH connection is reasonably secure. However, it might be relevant to ask what you are trying to do? Do you have a specific activity that absolutly must have telnet and only telnet? Or are you just trying to connect?

User avatar
jahboater
Posts: 6519
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: telnet to Pi

Mon Dec 10, 2018 5:00 pm

Or

ssh pi@192.168.1.101

A couple of simple steps also allows you to securely log in without having to give a password.

Lxw2015
Posts: 85
Joined: Fri Feb 12, 2016 4:05 am

Re: telnet to Pi

Mon Dec 10, 2018 5:09 pm

scotty101 wrote:
Mon Dec 10, 2018 4:51 pm
Have you installed a telnetd on to your Pi? I don't think it installed by default since for most applications, people will use SSH.

SSH != Telnet.

What is your use case for using telnet rather than SSH?
thank you. I though telnet is using SSH. I used to use telnet for remote login to Pi. and it works. don't know why not work any more.

Lxw2015
Posts: 85
Joined: Fri Feb 12, 2016 4:05 am

Re: telnet to Pi

Mon Dec 10, 2018 5:12 pm

jahboater wrote:
Mon Dec 10, 2018 5:00 pm
Or

ssh pi@192.168.1.101

A couple of simple steps also allows you to securely log in without having to give a password.
thank yo so much. it worked! I wonder what's the diff between SSH and telnet? why telnet won't work?

tpyo kingg
Posts: 972
Joined: Mon Apr 09, 2018 5:26 pm
Location: N. Finland

Re: telnet to Pi

Mon Dec 10, 2018 5:14 pm

Telnet is not there any more so it won't work. Since 1995 or so, there has been SSH instead.
Lxw2015 wrote:
Mon Dec 10, 2018 5:09 pm
don't know why not work any more.
That would be because telnet is not safe. The user name, password, and all of the data to and from the machine are transfered in the clear, completely unencrypted. The SSH client encrypts everything, plus has a lot more capabilities.

Once you are in you can follow the hint that jahboater has given above and use keys for authentication instead of passwords.

User avatar
jahboater
Posts: 6519
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: telnet to Pi

Mon Dec 10, 2018 5:29 pm

On your PC (not on the Pi) type ...

ssh-keygen -t rsa

accept the defaults for all the questions (hit <return> a few times). It probably defaults to rsa, so you may not need the -t option.
Then:

ssh-copy-id pi@192.168.1.101

will transfer the key to your pi (it will ask you for a password).

Then try ssh pi@192.168.1.101
and this time you should go straight in. This is called public/private key authentication and it is far more secure than giving a password - and quicker too.

You may also do

scp myfile pi@192.168.1.101:

and it will copy the file across to your home directory, again very quickly, with no annoying password request.

Finally, on your PC, put something like this in your ~/.bashrc

alias pi='ssh pi@192.168.1.101'

then you can just type pi to log into your Pi.

Lxw2015
Posts: 85
Joined: Fri Feb 12, 2016 4:05 am

Re: telnet to Pi

Mon Dec 10, 2018 5:38 pm

thank you so much for further info. I'm so lack of linux stuff.

Return to “General discussion”