SSH Guide For Complete noob?


55 posts   Page 1 of 3   1, 2, 3
by pmgmr2 » Tue Apr 24, 2012 1:17 am
Hello, I just got my raspberry pi and I've been trying to figure out how to VNC into it from my laptop..I found a guide online for this:

http://www.cnx-software.com/20.....pberry-pi/

...but the first step says to "Connect via SSH"...I've installed Putty on my Win7 laptop and entered the local IP of the rPi and entered my username, but I'm still getting "connection refused"

I've never used SSH and know almost nothing about it, but I've been scouring guides for a couple days and come up with nothing....please help!  Thank you.
Posts: 13
Joined: Wed Feb 29, 2012 5:38 am
by abishur » Tue Apr 24, 2012 1:25 am
Welcome to the forums!

Let's start at the beginning, what distro are you using (Debian, Fedora Remix?)

Second, when you say "you input your user name" do you mean pi/raspberry?  Or did you make a new user on the R-pi?
Dear forum: Play nice ;-)
User avatar
Forum Moderator
Forum Moderator
Posts: 4266
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
by sandbasser » Tue Apr 24, 2012 1:43 am
Are you sure you have some kind of SSH server running on the Pi???  (I believe i read somewhere that one of the distros has SSH turned off by default.)

Can you ping the IP Address of the Pi???

"Connection refused" can mean there"s no listener on port 22 on the IP address you"re trying to connect to; and, it can also mean that you"ve got your SSH setting wrong in PuTTY.

I haven"t got my Pi yet so I"m afraid i can"t offer anything other than these few basic suggestions.

Another thing to try in PuTTY is to NOT enter a auto-login username PuTTY's Connection-Data config but let it prompt you…IIRC the first time you connect it will prompt to accept a default certificate.

-Ray
Posts: 1
Joined: Wed Dec 28, 2011 11:55 am
by abishur » Tue Apr 24, 2012 1:56 am
Side note if it's the debian build and you haven't done this yet, you'll need to in order to turn on SSH

rename boot_enable_ssh.rc to boot.rc on the boot partition you can do this by issuing the following the commands

1. sudo bash

2. cd /boot

3. mv boot_enable_ssh.rc boot.rc

4. shutdown -r -time now

Once it finishes rebooting you'll have ssh enabled
Dear forum: Play nice ;-)
User avatar
Forum Moderator
Forum Moderator
Posts: 4266
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
by ukscone » Tue Apr 24, 2012 2:01 am
[edited because Abishur got to it before me but leaving one bit in :) ]

Once you have done the above as Abishur posted all should be good except

you'"ll have to wait a couple minutes or so for sshd to come up. if you try before it is ready you"ll get the connection refused message.
User avatar
Forum Moderator
Forum Moderator
Posts: 2764
Joined: Fri Jul 29, 2011 2:51 pm
by pmgmr2 » Tue Apr 24, 2012 2:18 am
Abishur said:


Welcome to the forums!

Let's start at the beginning, what distro are you using (Debian, Fedora Remix?)

Second, when you say "you input your user name" do you mean pi/raspberry?  Or did you make a new user on the R-pi?


Thank you for the warm welcome and quick reply!  I am using the 4-19 Debian distro on a 8GB SDHC card.  The username & pwd are the default "pi" and "raspberry" respectively.
Posts: 13
Joined: Wed Feb 29, 2012 5:38 am
by pmgmr2 » Tue Apr 24, 2012 2:20 am
sandbasser said:


Are you sure you have some kind of SSH server running on the Pi???  (I believe i read somewhere that one of the distros has SSH turned off by default.)

Can you ping the IP Address of the Pi???

"Connection refused" can mean there"s no listener on port 22 on the IP address you"re trying to connect to; and, it can also mean that you"ve got your SSH setting wrong in PuTTY.

I haven"t got my Pi yet so I"m afraid i can"t offer anything other than these few basic suggestions.

Another thing to try in PuTTY is to NOT enter a auto-login username PuTTY"s Connection-Data config but let it prompt you…IIRC the first time you connect it will prompt to accept a default certificate.

-Ray


Yes, I am able to ping the pi and when I didn't enter an autologin in putty, I got the same "connection refused" error.
Posts: 13
Joined: Wed Feb 29, 2012 5:38 am
by abishur » Tue Apr 24, 2012 2:21 am
Did you try what I mentioned in my second post?
Dear forum: Play nice ;-)
User avatar
Forum Moderator
Forum Moderator
Posts: 4266
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
by pmgmr2 » Tue Apr 24, 2012 2:26 am
Abishur - I just tried your method and it totally worked; the solution seemed so simple once I understood what was wrong!

Thank you so much for your help; I'm just getting started with linux and I'm looking forward to this new SSH world that's been opened to me.
Posts: 13
Joined: Wed Feb 29, 2012 5:38 am
by abishur » Tue Apr 24, 2012 3:00 am
No prob!  I only knew it because Ukscone mentioned it in a tweet and the comments on a blog post.  It's pretty new tech so there's not any one "I know everything" person here ;-)
Dear forum: Play nice ;-)
User avatar
Forum Moderator
Forum Moderator
Posts: 4266
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
by Tass » Tue Apr 24, 2012 12:09 pm
Perfect – just what I needed!!  I found that while SSH started automatically on the earlier Debian images, the it didn't on the latest one (19-04-2012), ending up with the same "connection refused" error.

While we're all here….  This works really well, I can start up VNC, etc., and I can connect.  This works well if I'm wanting to use the Pi as a completely headless machine.  Eventually though I'm considering connecting my Pi to my TV to play media, and want to be able to connect remotely.  When running vncserver it creates a new instance and allows me to connect to that.  I want to be able to connect to and control the instance currently running on the TV?

EDIT: BTW, I've got a guide here that will allow you to control the resolution of VNC that you start up on the Pi - I found that useful when connecting in from my laptop http://myraspberrypiexperience.....p-vnc.html
User avatar
Posts: 535
Joined: Sat Jan 21, 2012 11:15 am
by Joe Schmoe » Tue Apr 24, 2012 12:30 pm
FWIW, isn't the core issue in this thread the old "chicken-and-egg" problem?

I.e., the way I heard the talk here is that someone was running headless, and couldn't get in via SSH (because it is disabled by default).   And the point is then, of course, that if you are running headless, you can't get in to the machine (I.e., the Pi) any other way to make the changes needed to get SSH running.

So, it seems to me, the advice we should be giving is how to fix it using another PC (i.e., not using the Pi itself).  And for that, you will need a Linux machine with an SD card reader - and mount it and rename that file and so on and so forth.
Never answer the question you are asked. Rather, answer the question you wish you had been asked.

- Robert S. McNamara - quoted in "Fog of War" -
Posts: 2510
Joined: Sun Jan 15, 2012 1:11 pm
by Tass » Tue Apr 24, 2012 12:34 pm
Joe Schmoe said:


FWIW, isn't the core issue in this thread the old "chicken-and-egg" problem?

I.e., the way I heard the talk here is that someone was running headless, and couldn't get in via SSH (because it is disabled by default).   And the point is then, of course, that if you are running headless, you can't get in to the machine (I.e., the Pi) any other way to make the changes needed to get SSH running.

So, it seems to me, the advice we should be giving is how to fix it using another PC (i.e., not using the Pi itself).  And for that, you will need a Linux machine with an SD card reader - and mount it and rename that file and so on and so forth.


Well, technically you can get in without a screen by booting up and very carefully typing the following in:

pi

raspberry

sudo /etc/init.d/ssh start

But I get your point :)
User avatar
Posts: 535
Joined: Sat Jan 21, 2012 11:15 am
by Joe Schmoe » Tue Apr 24, 2012 12:39 pm
I get your point...

But isn't the usual meaning of "headless" that you have no screen or keyboard?
Never answer the question you are asked. Rather, answer the question you wish you had been asked.

- Robert S. McNamara - quoted in "Fog of War" -
Posts: 2510
Joined: Sun Jan 15, 2012 1:11 pm
by frying_fish » Tue Apr 24, 2012 12:50 pm
True, but for troubleshooting, or a quick temporary thing, hooking up a keyboard to login and start SSH, then disconnecting going back and setting SSH to run at boot everytime from then on isn't such a bad idea.
User avatar
Posts: 80
Joined: Mon Jan 23, 2012 3:26 pm
by ukscone » Tue Apr 24, 2012 2:05 pm
Joe Schmoe said:


.And for that, you will need a Linux machine with an SD card reader – and mount it and rename that file and so on and so forth.


the file is in the fat partition which windows can see so you don't need a linux machine. any old thing with an sd card read/writer will do
User avatar
Forum Moderator
Forum Moderator
Posts: 2764
Joined: Fri Jul 29, 2011 2:51 pm
by pmgmr2 » Wed Apr 25, 2012 3:56 pm
Hello again!  I'm SSH'ing like a champ, but having trouble getting the correct GUI to come up.  Whenever I connect, it brings up a screen with the LXDE background, NOT the raspberry logo background.  Additionally, I can't click the toolbar...that is, it simply doesnt respond to my mouse click.  I did some research and I guess this is a different X display....?

Anyway, I did some more research, and found out about x11vnc at this page and installed it:

https://wiki.archlinux.org/index.php/X11vnc#Setting_up_x11vnc

Here's the bizarre thing: If I open startx from the raspberry pi itself and then move to my windows computer to SSH in & run tightVNC client, I'm able to remotely get the 'right' deskop with the rPi background.

If I do everything from the windows computer (SSH in, run startx, and run x11vnc) it gives me that blue LXDE desktop.

What am I doing wrong?
Posts: 13
Joined: Wed Feb 29, 2012 5:38 am
by Gert van Loo » Wed Apr 25, 2012 5:53 pm
Joe Schmoe said:


FWIW, isn't the core issue in this thread the old "chicken-and-egg" problem?

I.e., the way I heard the talk here is that someone was running headless, and couldn't get in via SSH (because it is disabled by default).   And the point is then, of course, that if you are running headless, you can't get in to the machine (I.e., the Pi) any other way to make the changes needed to get SSH running.

So, it seems to me, the advice we should be giving is how to fix it using another PC (i.e., not using the Pi itself).  And for that, you will need a Linux machine with an SD card reader - and mount it and rename that file and so on and so forth.


You can access the boot directory from any Windows PC with an SD card reader. There you can make the changes you want and then plug it into a Pi and use it. It is still not exactly a "chicken-and-egg" problem, more a "chicken-and-duckegg" problem as you can use a more common patform (chicken) to get your duck hatched.

I have used it in the opposite direction as well. The gertboard demo software was debugged on a Pi with no network access. Then I copied the final files to /boot and pulled them off using a Windows PC.
User avatar
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1986
Joined: Tue Aug 02, 2011 7:27 am
by Joe Schmoe » Wed Apr 25, 2012 6:02 pm
FWIW, I never looked into things closely enough to really tell what was in which partition.  I sort of assumed that all that needed to be in the FAT partition was the bare metal files - that is, the things leading up and including booting the kernel - and that everything else (all the other stuff that goes into the boot process, including starting the daemons) would be in the Linux (i.e., EXT{whatever}) partition.

Anyway, if you can do this task (re-enabling SSH) from a Windows PC as well, then that's (obviously) all to the good!

And, of course, just for completeness, if the needed files did reside on an EXT{whatever} partition, then you could get one of those "read Linux disks from Windows" thingies and install that on your Windows box and still be able to do it without needing to invoke the dreaded "L word".
Never answer the question you are asked. Rather, answer the question you wish you had been asked.

- Robert S. McNamara - quoted in "Fog of War" -
Posts: 2510
Joined: Sun Jan 15, 2012 1:11 pm
by obarthelemy » Wed Apr 25, 2012 7:03 pm
I've tried those "ext for windows" tools, none I could find works reliably, or at all.
Posts: 1399
Joined: Tue Aug 09, 2011 10:53 pm
by Tass » Wed Apr 25, 2012 7:32 pm
OK - so can someone clarify what file we need to actually change, and what we need to change in it?
User avatar
Posts: 535
Joined: Sat Jan 21, 2012 11:15 am
by abishur » Wed Apr 25, 2012 8:56 pm
Tass said:


OK - so can someone clarify what file we need to actually change, and what we need to change in it?



4th post in this thread
Dear forum: Play nice ;-)
User avatar
Forum Moderator
Forum Moderator
Posts: 4266
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
by Tass » Wed Apr 25, 2012 9:06 pm
Abishur said:


Tass said:


OK - so can someone clarify what file we need to actually change, and what we need to change in it?


4th post in this thread



D'oh!! :)   Thanks a lot - works a treat!!
User avatar
Posts: 535
Joined: Sat Jan 21, 2012 11:15 am
by abishur » Wed Apr 25, 2012 9:08 pm
Tass said:


Abishur said:


Tass said:


OK - so can someone clarify what file we need to actually change, and what we need to change in it?


4th post in this thread


D'oh!! :)   Thanks a lot - works a treat!!



;-) :-P
Dear forum: Play nice ;-)
User avatar
Forum Moderator
Forum Moderator
Posts: 4266
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
by lufflumh » Wed May 09, 2012 6:09 pm
right – im clearly doing something wrong somewhere around here!

i've tried the whole sudo bash, cd /boot, mv bla bla bla…and it come up with no such file or directory, i am using debian and can't get the ssh to work.

also, i read in another thread (http://www.raspberrypi.org/for.....spberry-pi) and it say's to set something, in the ssh bit.

now i am new to setting up an ssh, so could anyone help me out and try to resolve this issue, i am going to rewrite my sd card with a new image to get back to square and try it all again, but if anyone can see anything obvious i have done wrong then please call me a numpty and put me in the corner with a dunse hat on. --just reloaded the image and the sudo bash, mv thing worked fine.

i am now struggling to work out how to find out the ip address of my pi, i have it plugged straight into my laptop through the enthernet port.

any suggestions?
Posts: 10
Joined: Tue May 08, 2012 11:04 am