I want to turn my raspberry pi 3 model B into a public server (only for testing purposes not production purposes). I have a second windows PC in which cygwin is available for linux commands such as:

ssh root@ipadress -p port 

When I try to connect my raspberry pi locally using putty with the local ip adress, I can reach raspberry pi's terminal over putty.

enter image description here

But I cannot connect raspberry pi with the 'ssh' command neither using local ip adress nor public ip adress.

enter image description here

enter image description here

Locally 'permission denied' warning appears, publicly 'connection refused' warning appears. What can be the source of my problem? - PS: I also cannot connect with putty using the public ip.

1 Answer 1


that's many problem in one.

first do not use -p portnumber as ssh will listen in port 22 (unless you have change it in /etc/ssh/sshd_config)

next, by default root login is disable in raspian, have you enabled it ?

To do so edit /etc/ssh/sshd_config, there is a line with PermitRootLogin, simply change no to yes, uncomment if need be, restart ssh (or reboot).

next, putty screenshot do not show which user connect, maybe pi ? if so try

ssh -l pi localip

finally, to access rapsberry from you public IP, you have to setup your modem to NAT (Network Address Translation) public IP to local IP for port 22. See your modem interface for this.

  • I modified my port number this is why I use -p portnumber, how will I enable root login for raspberry pi? Mar 29, 2017 at 7:10
  • edited, ssh can be restarted with service ssh restart.
    – Archemar
    Mar 29, 2017 at 7:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .