spectrepaul
Posts: 9
Joined: Mon Sep 10, 2012 11:05 pm

Auto Login of new Rasbian Wheezy

Mon Sep 10, 2012 11:09 pm

Ok, I am new to this Pi thing but have so far managed to ssh, vnc through my laptop and am getting there, however I can't find a good tutorial so far on how to auto login with the Raspian Wheezy version if someone could help.

I want to do this so that I don't have to login on the telly before having to use the laptop with the ssh and vnc, sort of defeats the object of doing this in the first place.

I will then be looking to see how to remote ssh from a computer not on my network and maybe set up a HD as a sort of nas drive to stream around the house and over the internet.

Any help appreciated, thanks.

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

Re: Auto Login of new Rasbian Wheezy

Tue Sep 11, 2012 8:43 am

There was a good tutorial in issue 3 (page 3) of the free MagPi magazine
www.themagpi.com

User avatar
penguintutor
Posts: 386
Joined: Tue May 08, 2012 9:11 am
Location: UK
Contact: Website

Re: Auto Login of new Rasbian Wheezy

Tue Sep 11, 2012 9:09 am

Do you mean have the Raspberry Pi start LXDE and login automatically?

That is on the Wiki: http://www.elinux.org/RPi_Debian_Auto_Login

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

Re: Auto Login of new Rasbian Wheezy

Tue Sep 11, 2012 9:17 am

I just read the first post again and I am not sure the proposed solutions will fix your problem.

Why do you need to login using the TV before you can login using VNC? Can you explain what your problem is?

spectrepaul
Posts: 9
Joined: Mon Sep 10, 2012 11:05 pm

Re: Auto Login of new Rasbian Wheezy

Tue Sep 11, 2012 10:38 am

Yes, I don't think I explained it very well but the Magpi magazine is on the right lines I think.
I don't want to auto get into startx but what I want to do is get the pi to auto login to the command prompt and basically do the - login (p)i and password (raspberry) automatically.

The problem is when I look in the inittab, it doesn't say what the Magpi magazine says, it is on the same lines but not quite the same, can't remember what it says now as am at work but doesn't say:

1:2345:respawn:/sbin/getty 115200 tty 1

something similar though with diferent numbers I think.

Hope this makes sense?

At the moment though I have to log in and password on the Pi itself via the keyboard and TV connected to it before I can then ssh into it with my laptop.
I want to auto login so I can ssh via my laptop without having to do the login on the Pi first.

I am not wanting to auto startx as I have setup vnc and can see this in the laptop when logged in.

Programs I am using are Putty and tightVNC.

I think I am nearly there and not doing to bad with this Rapsberry Pi thing at the minute just little tweeks :)

Any advice on after doing this in then logging into the Pi from a computer not on the home network, eg from the work computer over the internet and also setting up the hard drive or usb stick to act as sort of a NAS drive to then read and write to this from the home network and over the internet on another computer?

I know asking for a lot but want to get this sorted before even trying to explain it all to my 12 year old son and then get him into programming, :lol:

Thanks for help in advance.

spectrepaul
Posts: 9
Joined: Mon Sep 10, 2012 11:05 pm

Re: Auto Login of new Rasbian Wheezy

Tue Sep 11, 2012 11:14 am

Forgot to also mention that I have set up Samba on the Pi along with so far a shared/public folder on the SD card to test if I could copy a file from my windows 7 pc to it and open the file from the Pi, which I could.

I think only a few steps away from creating a USB stick with a shared folder then if that works a hard drive?

User avatar
RaTTuS
Posts: 10559
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Auto Login of new Rasbian Wheezy

Tue Sep 11, 2012 11:44 am

Change it from
1:2345:respawn:/sbin/getty --noclear 38400 tty1
1:2345:respawn:/bin/login -f pi tty2 </dev/tty1 >/dev/tty2 2>&1
where pi is the usernaem of the user you want to log in
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

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

Re: Auto Login of new Rasbian Wheezy

Tue Sep 11, 2012 12:50 pm

spectrepaul wrote:At the moment though I have to log in and password on the Pi itself via the keyboard and TV connected to it before I can then ssh into it with my laptop.
This very strange, the reason we use SSH is to allow for the fact that there may be no keyboard or monitor connected.

What error do you see if you try to SSH into the RPi when you have not logged in?
Is there some command you normally enter on the keyboard to enable SSH?

User avatar
penguintutor
Posts: 386
Joined: Tue May 08, 2012 9:11 am
Location: UK
Contact: Website

Re: Auto Login of new Rasbian Wheezy

Tue Sep 11, 2012 12:57 pm

You don't need to login to the computer locally before you can ssh to it.

What are you doing after you login? Or do have you got some commands in the .bashrc that are being called that you need running? It should be possible to connect remotely without ever touching the Raspberry Pi?

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Auto Login of new Rasbian Wheezy

Tue Sep 11, 2012 1:35 pm

penguintutor wrote:You don't need to login to the computer locally before you can ssh to it.
You do if you start up the sshd from that initial login.

I have a machine where I do exactly that - and for good reason.

I'm actually a proponent of doing more of this sort of stuff from an initial login than from init.d scripts - for what should be fairly obvious reasons.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

spectrepaul
Posts: 9
Joined: Mon Sep 10, 2012 11:05 pm

Re: Auto Login of new Rasbian Wheezy

Tue Sep 11, 2012 1:49 pm

If I don't log in first then Putty goes to the terminal page with a blank cursor but doesn't ask for the Login and Password details, just stays at blank cursor.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Auto Login of new Rasbian Wheezy

Tue Sep 11, 2012 2:31 pm

spectrepaul wrote:If I don't log in first then Putty goes to the terminal page with a blank cursor but doesn't ask for the Login and Password details, just stays at blank cursor.
Interesting. I wonder what's up with that...
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

spectrepaul
Posts: 9
Joined: Mon Sep 10, 2012 11:05 pm

Re: Auto Login of new Rasbian Wheezy

Tue Sep 11, 2012 3:28 pm

Well just got home from work and turned on the Pi, I didn't log in to it but instead went straight to the laptop and tried the ssh. Can you believe everything is great! I can log in on the laptop now without having to do it first on the Pi and I can also vnc, etc. The shared folder is working fine on the SD card and I can transfer files to and from it in Windows 7. Amazing, can't see what I was doing last night but it works :)

Next thing I need to do is create a USB stick to share files and then will move on to the hard drive.

Can anyone point me in the right direction though to log in using the internet on any computer instead of just on the network though, so I can do what I can now but on any computer over the web?

Cheers everyone, :)

User avatar
RaTTuS
Posts: 10559
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Auto Login of new Rasbian Wheezy

Tue Sep 11, 2012 3:32 pm

RaTTuS wrote: 1:2345:respawn:/bin/login -f pi tty2 </dev/tty1 >/dev/tty1 2>&1
tty1*
that's what happen when you have something on tty2 that you want logged in all the time and forget to change all they bits*
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
penguintutor
Posts: 386
Joined: Tue May 08, 2012 9:11 am
Location: UK
Contact: Website

Re: Auto Login of new Rasbian Wheezy

Wed Sep 12, 2012 11:01 am

I have a machine where I do exactly that - and for good reason.

I'm actually a proponent of doing more of this sort of stuff from an initial login than from init.d scripts - for what should be fairly obvious reasons.
Perhaps you could elaborate on the obvious reason? I could understand if you are only running ssh when required to limit when ssh was running, but then you wouldn't want to automate the login as that would defeat the point of it.
Can anyone point me in the right direction though to log in using the internet on any computer instead of just on the network though, so I can do what I can now but on any computer over the web?
Do you mean being able to login to a computer on your home network from the Internet? If so you need to enable NAT/port forwarding on your router. It will depend upon the make / model of your router. On my Belkin Router it's under Firewall > Virtual servers

spectrepaul
Posts: 9
Joined: Mon Sep 10, 2012 11:05 pm

Re: Auto Login of new Rasbian Wheezy

Wed Sep 12, 2012 12:54 pm

Do you mean being able to login to a computer on your home network from the Internet? If so you need to enable NAT/port forwarding on your router. It will depend upon the make / model of your router. On my Belkin Router it's under Firewall > Virtual servers
Yes thats what I want to do next, I have a Sky router, think its netgear. Will check the settings on this.
Know what to do then to do this and can you ssh or vnc with this method including loading files from the Raspberry Pi, like streaming over the internet?

User avatar
penguintutor
Posts: 386
Joined: Tue May 08, 2012 9:11 am
Location: UK
Contact: Website

Re: Auto Login of new Rasbian Wheezy

Thu Sep 13, 2012 7:37 am

My Virgin Media Super Hub is Netgear so it may have the same options.

It's under Advanced > Security > Port Forwarding

It's not as flexible as my Belkin router as it doesn't allow you to map to a different port on the remote system, so if you want to be able to ssh into multiple computers you will need to change the ssh port so that they are all unique.

You can also port forward vnc etc., but from a security perspective I prefer to just allow ssh and then tunnel vnc over ssh.

spectrepaul
Posts: 9
Joined: Mon Sep 10, 2012 11:05 pm

Re: Auto Login of new Rasbian Wheezy

Thu Sep 13, 2012 4:40 pm

Will try this next, went on a bit of tangent and set it up as a web server. I have uploaded via ftp my old website to it and it works great on my laptop but when I was at work it wouldn't show the site and didn't connect.
Will the web server only work on the home network or is this to do with the port forwarding too.

Also do I have to set up a domain name if I wanted a proper web address or does the, just typing this in work ok? 192.168.....

When I originally had the site up and running I had a site name as www.spectrestudios.co.uk and this was done through 123reg and the site was uploaded to NTL web space which I had allocated.

Again this is going off at a tangent but am really loving this Raspberry Pi stuff and bringing back great memories from the Amiga days which I had forgotten, really want to get my lad into all this when got the hang of it! :)
Great stuff!!!

User avatar
penguintutor
Posts: 386
Joined: Tue May 08, 2012 9:11 am
Location: UK
Contact: Website

Re: Auto Login of new Rasbian Wheezy

Mon Sep 17, 2012 10:43 am

Again you need to setup the port forwarding. Port 80 is used for http.

You can just use the IP address if you are only running one web server, but you need to find your real IP address allocated by your ISP, rather than the 192.168.*.* which is a private IP address.

You should be able to find the real IP address from your router (perhaps under WAN settings), or see: http://www.penguintutor.com/blog/viewbl ... 530#public

If you want to access this using a DNS entry then you may want to look at using dynamic dns. I used cable broadband and it is very rarely that my IP address changes so I use a static DNS entry which I update whenever my IP address changes. This is typically: when replacing the cable modem; when the speed was increased and occasionally when other maintenance is performed by Virgin Media, but if you have a service that changes IP address regularly then you will need to register with a dynamic DNS service.

spectrepaul
Posts: 9
Joined: Mon Sep 10, 2012 11:05 pm

Re: Auto Login of new Rasbian Wheezy

Wed Sep 19, 2012 7:00 pm

Still not got round to doing this yet, so much to do on here at the minute, just set up the upgrade for the turbo mode!
Fantastic!!!!

Where will the Pi go next :)

bleketas
Posts: 8
Joined: Thu Dec 06, 2012 11:01 am

Re: Auto Login of new Rasbian Wheezy

Sun Dec 09, 2012 11:49 am

Hi,

i'm unable to autologin my raspberry, tried 2 methods with no luck. At first glance everything is fine, it boot's up and doesn't ask login and pasword shows pi@raspberrypi ~$, but then i cannot type any command, and time to time after lotsa keyboard presses it asks for password, but when i type it it says login failes blah blah.

any workarounds on this?

User avatar
RaTTuS
Posts: 10559
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Auto Login of new Rasbian Wheezy

Mon Dec 10, 2012 9:46 am

what keyboard and how is it plugged in [via a hub or direct]
as you have editing things then the keyboard has worked in the past
what does
tail -f /var/log/syslog say [ssh in if you keyboard is not working]
can you alt-f2 and login there
exactly what have you changed to auto login in
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

bleketas
Posts: 8
Joined: Thu Dec 06, 2012 11:01 am

Re: Auto Login of new Rasbian Wheezy

Mon Dec 10, 2012 10:53 am

it's wireless usb keyboard connected directly to usb port. I modified /etc/inittab as stated in tutorial, tried similar method with rungetty, but problem is the same. And i'm sure it's not a keyboard problem, because when i disable autologin everything becomes normal again.

BTW: in my inittab file 1:2345:respawn:/sbin/getty 38400 tty1 this line starts with T0:23:respawn.....
P.S. I can ssh to raspberry like normal.

User avatar
RaTTuS
Posts: 10559
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Auto Login of new Rasbian Wheezy

Mon Dec 10, 2012 11:24 am

my /etc/inittab
#1:2345:respawn:/sbin/getty --noclear 38400 tty1
1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1
^change the pi to your login name
this auto logs you in to a command prompt
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

bleketas
Posts: 8
Joined: Thu Dec 06, 2012 11:01 am

Re: Auto Login of new Rasbian Wheezy

Mon Dec 10, 2012 5:28 pm

As i stated before this doesnt work.

Return to “Beginners”