User avatar
grumpyoldgit
Posts: 1452
Joined: Thu Jan 05, 2012 12:20 pm

Re: SSH Guide For Complete noob?

Wed May 09, 2012 6:53 pm

I'm not even sure it will have an ip address. How is your laptop attached to the network? Is it not possible for the Pi to be attached directly to the router? If you log into your router you will be able to see the devices on your lan. If you are unsure what is what it is a good idea to make a note of all your devices and then note down the MAC address. Then see what is left. For instance my bedside clock has an ip address as it is an internet radio. So does my FreeSat box. You can check what your laptop can see by pinging them individually.

The real issue is that by attaching your Pi to your laptop, they may be physically attached to each other buy I don't think your Pi will be able to see the DHCP server in your router.

lufflumh
Posts: 10
Joined: Tue May 08, 2012 11:04 am

Re: SSH Guide For Complete noob?

Wed May 09, 2012 7:07 pm

grumpy old git, cheers, it looks like then (as expected) i am attacking this from completely the wrong angle.

if i explain what i am trying to do you might be able to tell me to stop being an idiot and thats not possible...

i was talking to a guy at work who is a bit of a whiz at these sorts of things and he said its a good idea to set up an ssh to control the pi from your laptop, so i set off on my way trying to acomplish this. he did mention to connect the pi to the laptop via ethernet. now, he could have meant to my laptop via ethernet by plugging the ethernet cable into the back of the router.

is it possible to set up an ssh using ethernet directly attached to a laptop via an ethernet cable?

thanks for the help guys, any other forums and i would have been cast aside and left to rot, not in this community though!

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: SSH Guide For Complete noob?

Wed May 09, 2012 7:13 pm

As grump said, unless you have ICS *shudder* set up, you pi won't have an ip address as the pi is set to dhcp by default. (side note, just to be sure, you're using a crossover ethernet cable to connect the two, right?  A normal ethernet cable will not allow the two to communicate while directly connected to each other)

I'm going to work off the assumption that you want to use the pi headless in the long run.  To make this work, you need to hook the pi up to a video display (even if it's just using the RCA connector) with a usb keyboard for just a minute.

Once you have it hooked up, log in and type in

sudo nano /etc/network/interfaces

I say nano, because I like that text editor, but vi works just as well.  In the file that opens up, change the line that says

iface eth0 inet dhcp

to

iface eth0 inet static

and add the following lines on the very next line under it filling in your information as appropriate

address 192.168.1.10
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

You technically only need address and netmask, but you can fill out the rest as you desire.
Dear forum: Play nice ;-)

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: SSH Guide For Complete noob?

Wed May 09, 2012 7:32 pm

If you are wiring the Rpi directly to your laptop, neither the RPi or the laptop will be able to fetch an IP address.

The instructions above show how to set a static address for the RPi, but you also need to set a static address for the laptop. It's very difficult to describe how to do this in writing, so search the internet for something like "how to set static address Windows XP" for example if your laptop uses XP.

The address on the laptop must be very similar to the address on the RPi, but can't be exactly the same. Just use a slightly different number for the last part, for example you can use .10 on the RPi and .11 on the laptop.

Warning: You must not plug the laptop into a router while you have a static address set (unless you understand how to avoid network conflicts, of course). Change the PC back to "fetch IP address automatically" before connecting it to your router. Otherwise you could get very strange random problems on your network.

Note that you can use any ethernet cable to connect your RPi to your laptop. You do not need a special crossover cable because the RPi has a modern autosensing ethernet port.

User avatar
SN
Posts: 1014
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
Contact: Website

Re: SSH Guide For Complete noob?

Wed May 09, 2012 7:34 pm

If you are connecting via a hub (rather than point-to-point)

Just a minor 'health warning# on abishur's last bit – not all Home Network Routers use the 192.168.1.x network – I have seen 192.168.0.x and 10.x.x.x

Suggest you run an ipconfig on your laptop to confirm appropraite values for netmask, network, broadcast and gateway values first.  And the address should be something outside the DHCP range your router is dishing out so there is no clash – I restricted my DHCP range to between x.x.x.2 and x.x.x.56 even though all the way to 254 is valid to give me space for static stuff

If I can't get a wireless adaptor running on mine I will also do a point-to-point ethernet connection to my Debian Laptop and (try and) set up routing over it to the internet...
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?

xmort
Posts: 3
Joined: Wed May 09, 2012 7:42 pm

Re: SSH Guide For Complete noob?

Wed May 09, 2012 8:46 pm

I done everything mentioned in this thread to run SSH but I have problems to login from putty. I can ping the RPi, SSH is running but everytime I enter password to putty "Access denied" message comes up as response. I tried original "raspberry" password and also the new one which I can successfully use to login directly on Rpi but without luck over SSH. Is there something I'm missing? I'm using latest official Debian distro and I changed password before I renamed example file to boot.rc and restarted (actually I also tried to change password after that but still no luck).

Thanks for any help.

User avatar
Tass
Posts: 535
Joined: Sat Jan 21, 2012 11:15 am

Re: SSH Guide For Complete noob?

Wed May 09, 2012 8:50 pm

OK - sorry to throw yet another angle into all this, but I know what you're trying to do and I do the exact same thing.  My Pi is connected to my laptop via USB (for power - optional) and ethernet.  I've got Internet Connection Sharing set up on my Wireless adapter (yes, I know ) and my ethernet adapter assigns itself an address of 192.168.137.1 and assigns my Pi a random IP Address.  I can connect to my Pi via SSH, I have internet access on the Pi, I can install VNCServer & VNC into my Pi from my laptop.

Before I go off on too much of a tangent, is this the sort of thing you're wanting to do?  If so I can try provide you with the details of how I do this.

User avatar
Tass
Posts: 535
Joined: Sat Jan 21, 2012 11:15 am

Re: SSH Guide For Complete noob?

Wed May 09, 2012 9:00 pm

xmort said:


I done everything mentioned in this thread to run SSH but I have problems to login from putty. I can ping the RPi, SSH is running but everytime I enter password to putty "Access denied" message comes up as response. I tried original "raspberry" password and also the new one which I can successfully use to login directly on Rpi but without luck over SSH. Is there something I'm missing? I'm using latest official Debian distro and I changed password before I renamed example file to boot.rc and restarted (actually I also tried to change password after that but still no luck).

Thanks for any help.



I've used putty and haven't had any issues, although I haven't change my password - left it as pi/raspberry and it worked without issue.  I'm not sure if the pw change has somehow messed it up for you?

Mad-Halfling
Posts: 8
Joined: Tue Apr 03, 2012 7:54 pm
Contact: Website

Re: SSH Guide For Complete noob?

Wed May 09, 2012 9:23 pm

xmort said:


I done everything mentioned in this thread to run SSH but I have problems to login from putty. I can ping the RPi, SSH is running but everytime I enter password to putty "Access denied" message comes up as response. I tried original "raspberry" password and also the new one which I can successfully use to login directly on Rpi but without luck over SSH. Is there something I'm missing? I'm using latest official Debian distro and I changed password before I renamed example file to boot.rc and restarted (actually I also tried to change password after that but still no luck).

Thanks for any help.



One thing to check is in /etc/ssh/sshd_config the line

PasswordAuthentication yes

isn't set to no or commented out with a # (can't remember if I changed mine, or note, when I got it working today)

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 27414
Joined: Sat Jul 30, 2011 7:41 pm

Re: SSH Guide For Complete noob?

Wed May 09, 2012 9:37 pm

Tass said:


xmort said:


I done everything mentioned in this thread to run SSH but I have problems to login from putty. I can ping the RPi, SSH is running but everytime I enter password to putty "Access denied" message comes up as response. I tried original "raspberry" password and also the new one which I can successfully use to login directly on Rpi but without luck over SSH. Is there something I'm missing? I'm using latest official Debian distro and I changed password before I renamed example file to boot.rc and restarted (actually I also tried to change password after that but still no luck).

Thanks for any help.


I've used putty and haven't had any issues, although I haven't change my password - left it as pi/raspberry and it worked without issue.  I'm not sure if the pw change has somehow messed it up for you?


That might be the case. I also have no problems logging in with the default username/password but I am doing it from Linux with a simple...

ssh pi@192.168.1.6

I assume you have changed the required file on the boot partition to enable SSH on startup.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

xmort
Posts: 3
Joined: Wed May 09, 2012 7:42 pm

Re: SSH Guide For Complete noob?

Wed May 09, 2012 9:45 pm

Yep, I changed the boot file and restarted. And I already checked /etc/ssh/sshd_config and PasswordAuthentication has been commented. I uncommented it, set to yes and restarted ssh demon but still Access denied from windows Putty

User avatar
Tass
Posts: 535
Joined: Sat Jan 21, 2012 11:15 am

Re: SSH Guide For Complete noob?

Wed May 09, 2012 10:29 pm

OK - I just connected my Pi & tried to connect with putty and it worked.  Interestingly I fumbled when I first typed the password and received the "Access Denied" message you mentioned.  When I retyped it, it connected successfully it.  It does sound like it's a password config issue...

lufflumh
Posts: 10
Joined: Tue May 08, 2012 11:04 am

Re: SSH Guide For Complete noob?

Thu May 10, 2012 5:51 pm

right i've got my pi connected and i logged in using the putty thing.

i have logged in to it and have donloaded some stuff to the pi using the apt-get process.

but startx won't run! what am i doing wrong now.

do i have to load something else on to my flaptop for the startx command to work?

thanks for your help so far guys!

User avatar
Tass
Posts: 535
Joined: Sat Jan 21, 2012 11:15 am

Re: SSH Guide For Complete noob?

Thu May 10, 2012 6:31 pm

@lufflumh sounds like you're making good progress.  I think I can see where you're going wrong.  Are you trying to run startx from Putty under Windows?  If so, that's not going to work.  You can only run startx from the Pi itself if it's connected to a display.

What you need to do is install a VNC server on the Pi (sudo apt-get install tightvnc) and then launch vncserver (vncserver :0 -geometry 1280 x 800 -depth 16 -pixelformat rgb565) - both done from Putty.  Then you can VNC from your Windows machine into that VNC instance).  When you run the vncserver command from Putty it essentially starts a virtual X session on the Pi that you can VNC into.

I've got more details here:

http://myraspberrypiexperience.....p-vnc.html

If that's not where you're stuck let me know and I'll see if I can help

lufflumh
Posts: 10
Joined: Tue May 08, 2012 11:04 am

Re: SSH Guide For Complete noob?

Thu May 10, 2012 7:00 pm

yer i fudged my way through the guide you wrote.

i'm all sorted now, the main question i didn't get answered but luckily someone at work managed to answer for me was how to find the ip address of the pi itself.

i'll explain how i did it for any noobs like me out there (please don't be too shocked by how basic this may seem to some of you)

to find the ip address of the pi you have to log in to your router, to do this go to your internet browser (internet explorer/firefox) and in the adress bar type in the ip adress of the router, in my case (for sky routers) 192.168.0.1 and hit enter.

this prompts you for a username: admin, and a password: sky. i found these here http://www.skyuser.co.uk/forum.....stats.html

then go to the "attached devices" tab and hit refresh with out the pi plugged in to your router via an ethernet cable. there should be displayed all the ip address's for attached devices, plug your pi in via ethernet and hit refresh again, a new ip address should appear in the list (or in my case two??) choose the top one of the two and use that to use for your the pi's ip address.

also something else i didn't find very clear, with the guide in the mypiexperience blog was the display name part, where you type the ip address:display name in, i didn't realise that the display name is simply 1 and to add it on you just type :1 after the ip address i.e. 192.168.0.3:1

again, i am starting from near enough scratch so apologise for how basic this all is. this is the first time i have encountered linux! i know, developers release...i've read that a bunch of times before...

User avatar
Tass
Posts: 535
Joined: Sat Jan 21, 2012 11:15 am

Re: SSH Guide For Complete noob?

Thu May 10, 2012 7:15 pm

Oh, don't appologise!  While this is a developer release, without people trying out what the developers come up with the project wouldn't make the progress it needs to.  Your feedback it crucial to getting things in place for the educational release.  Thanks for the feedback on the blog - I'll try clarify those sections.  And thanks for chipping in your own solution to finding the IP Address!

xmort
Posts: 3
Joined: Wed May 09, 2012 7:42 pm

Re: SSH Guide For Complete noob?

Thu May 10, 2012 7:16 pm

Just a quick update about my SSH problems. I solve it by reinstalling whole SD card. I loaded debian image, rename SSHD boot.rc file right from Windows so it is there for the first RPi start, then booted RPi, tried SSH via Putty with default password, then with changed password, then with regenerated openssh keys and everything worked as it should.

After some more digging problem has been probably caused by ~/.ssh/known_hosts file. I found note somewhere that after key regenarate operation, file must be sometimes touched (with touch command or edited by vi) if it was previously used which is probably my case. I hope this help someone in future.

lufflumh
Posts: 10
Joined: Tue May 08, 2012 11:04 am

Re: SSH Guide For Complete noob?

Thu May 10, 2012 9:14 pm

@tass you are too kind!

i am really getting in to this stuff now though, a week ago (no joke) i couldn't pronounce linux and now i've managed to accomplish all this. all because of a nice slice of pi!!

trikidiki
Posts: 12
Joined: Thu Mar 15, 2012 9:00 pm

Re: SSH Guide For Complete noob?

Thu May 10, 2012 11:39 pm

Hi,

I'm new to Linux so please bear with me.

I have followed the instructions in this post and the linked blogs and have successfully connected from my PVC to the Raspi. Thanks to everyone for that.

When I've finished with the connection on the PC, I assume the X session and tightvncserver are still running in the background (using precious resources). How do I 'switch them off' without rebooting.

Cheers,

Dik

Oh yes. And what does the '&' after the startx  do?

Steady_Bear
Posts: 110
Joined: Sat Jan 14, 2012 12:06 pm

Re: SSH Guide For Complete noob?

Thu May 10, 2012 11:56 pm

If you add & to the end of a command it sends the command to the background giving you the console back for other use.

If you started the commands under the ssh login, when you logout the automatically get killed. Unless you invoke nohup (no hang up). I've not read the full thread to know what you've done here exactly.

Else you can kill it, or more correctly try and find a way to politely ask it to shutdown...

To kill the stuff you can run 'top', hit 'k', then type in the number under the 'pid' column corresponding to the name of the process, then hit enter.

Or, if you know the name of the process you could just type

killall process-name

If you have many xcalcs running and you want to kill only one, then the second route would kill all as the name suggests.

'command-name --help' should provide some info, or type 'man command-name'. My apologies for sending you down the read the manual route, but it is late :s.

Back to fun on the command line. Using the following commands for fun...

sleep 10

echo "Hello World

Try adding &, &&, ; after the commands, and make a little list, ie:

sleep 10; echo "Hello World"

sleep 10& echo "Hello World" (what happens if you run the command 'jobs' straight after executing these?)

I'll let you figure out the difference. Although, I'll say now - I've just learn't that && is like ;, but conditional ! 10 years of use and I've only just learnt that

trikidiki
Posts: 12
Joined: Thu Mar 15, 2012 9:00 pm

Re: SSH Guide For Complete noob?

Fri May 11, 2012 12:24 am

Thanks Steady_Bear.

I tried starting it from SSH first then rebooted and tried it directly from the Raspi, which is when it dawned on me the processes were still running after I disconnected UltraVNC , so hadn't thought about it when it was started from SSH.

I'm happy with the RTFM response except that not knowing the commands TOP and KILLALL its sort of difficult looking them up.

I'll try and get my head around your 'question' tomorrow. As you say its getting late.

Cheers

Steady_Bear
Posts: 110
Joined: Sat Jan 14, 2012 12:06 pm

Re: SSH Guide For Complete noob?

Fri May 11, 2012 3:52 pm

Ha, there's not much else to read for top or killall. The RTFM was for the VNC software et al. The software, if intended to run in the background may allow you to kill it politely.

I would never expect a person to read up on a piece of software they haven't heard of yet! Unless it was a Saturday.

lyzby
Posts: 24
Joined: Sun Nov 20, 2011 3:34 am

Re: SSH Guide For Complete noob?

Sat May 12, 2012 3:37 am

I’ve also encountered the problem of not being able to ssh in after changing the password.  This is with debian.  I changed the password immediately after getting in, and then the next thing I did was start sshd.  Couldn’t log in.  Found this thread and tried the suggestions up to that point, without joy.

I reloaded the image onto a new SD card and rebooted, renamed the file in /etc/boot, rebooted, and was immediately able to ssh in with putty from a windows laptop (with the original password). 

I’ve now read the most recent posts in this thread, and see something else to try on the other card—regenerating the keys.  It’s not something I’ve had to do in several dozen installations on little Linux devices—but I never changed the password from what I had originally entered.  I’ll try regenerating the keys on the original card.

… hmmm, no joy.

I did these:

sudo /bin/rm /etc/ssh/ssh_host_*

sudo /usr/sbin/dpkg-reconfigure openssh-server

Then I happened to notice in typing that the shifted number keys on my keyboard were not typing what I expected, and one of them was used in my password.  So I reconfigured the keyboard to USA with:

sudo /usr/sbin/dpkg-reconfigure keyboard-configuration

Changed the password again, regenerated the keys, and finally putty worked from a windows laptop with my desired password. 

Now I’m going headless.

 

ian.macken
Posts: 2
Joined: Sat May 12, 2012 2:22 pm

Re: SSH Guide For Complete noob?

Sat May 12, 2012 3:39 pm

Hi,

sorry if i have posted this in completly the wrong place.

I am new to linux and have got an issue trying to get tightvncserver to start from boot.

it all works if i manually start tightvncserver from the terminal, but ideally i want it to start from boot so that i can work on the pi from my laptop without having to take over the TV.

I have followed the instructions on http://elinux.org/RPi_VNC_Server but the tightvncsever still isnt running on boot.  where the link above is refering to the VNCBOOT file is there anything in there that i need to change to get it to run tightvncserver?

I have just entered that text into the file word for work, i am i meant to be replacing any part of the script.

i am running debian 19/04/12 release and i have enabled ssh on boot.

Thanks in advance

Mac

prodata
Posts: 176
Joined: Tue Jan 24, 2012 5:53 pm
Contact: Website

Re: SSH Guide For Complete noob?

Sat May 12, 2012 7:42 pm

Likewise a new Linux user, with a couple of ssh-type questions:

If I just want to access the Pi shell remotely (purely across my local LAN) from a Windows box then is there any reason to look beyond Putty? Is Putty the only such compatible ssh client to consider (I'm sure there might be others, but to rephrase: is Putty the accepted standard tool, or does it have competition?)

Is there any such tool that might also have FTP built-in (ie so that a file could easily be transferred between local and remote devices) or is the only answer to use a separate FTP tool.

Then, if I did actually want to control an X windows session remotely, what is the choice of recommended tools? I see talk of TightVNC and UltraVNC but without getting any sense of whether these are the only or necessarily the best (free) VNC tools. Can I assume that VNC is some sort of established standard so that you can use say TightVNC on the Pi and UltraVNC on the PC. Or do the server and client need to match? Does Windows (eg Vista/7) have a VNC client already built-in, which could be used. What about using say TeamViewer on the PC – just something I have and use already for remote access or does this use some different/proprietary protocol?

Sorry for all the questions – it's just tricky trying to get a picture of how to get remote access to a Pi most easily and efficiently. (And I don't like loading up my Windows PC with a pile of utilities that may not actually be necessary.)

Return to “Beginners”