tylerv
Posts: 10
Joined: Sun Jan 12, 2014 6:59 am

Auto login issue

Wed Mar 11, 2015 2:31 am

So previously I setup my pi to automatically login as root. However after learning that it's safer to login as pi, I wanted to change it. When the pi turns on it immediately logins as root. I checked the file:

/etc/inittab

Many tutorials claim to edit the line:

Code: Select all

1:2345:respawn:/sbin/getty --noclear 38400 tty1
To:

Code: Select all

1:2345:respawn:/bin/login -f pi  tty1 </dev/tty1 >/dev/tty1 2>&1
I did this, but my RPi still boots into root. There must be some other file logging my RPi into root.

How can I stop this and make it boot into pi instead?

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: Auto login issue

Wed Mar 11, 2015 5:13 am

Whether or not you login as root or as another user doesn't matter. Each has it's security drawbacks. Personally, I lock the pi account, assign the root account a good password and then create my own account. WHen I need root, I use su.
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

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

Re: Auto login issue

Wed Mar 11, 2015 6:06 am

Note that the method shown by OP - that of changing the simple line into that weird thing with the multiple redirections - is a way of turning auto-login on, not off. Because of that change, the system will now auto-login as pi on tty1.

So, whatever method OP had used to auto-login (some tty) as root, is still in effect. We need to know what method that was, so that we can change/remove it (if that is indeed what we want to do).

Note, BTW, that the weird method with the multiple redirections is not the ideal way to perform auto-login, despite the fact that it is common in various online tutorials.
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)

tylerv
Posts: 10
Joined: Sun Jan 12, 2014 6:59 am

Re: Auto login issue

Wed Mar 11, 2015 12:57 pm

What are some places I can look for to stop the log in of root? Also I need to log in as pi because chromium can't run as root.

User avatar
RaTTuS
Posts: 10412
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Auto login issue

Wed Mar 11, 2015 1:01 pm

if you change the tty login to

Code: Select all

1:2345:respawn:/sbin/getty 115200 tty1
then that will just put up a login prompt on the first terminal
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

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

Re: Auto login issue

Wed Mar 11, 2015 1:01 pm

tylerv wrote:What are some places I can look for to stop the log in of root? Also I need to log in as pi because chromium can't run as root.
Understood, so logging in as pi - and then auto-running Chromium from there - is a Good Thing.

Just so we all understand and are on the same page, can you answer these two questions:
  1. Why do you think it is auto-logging in as root? I'm not saying it is not, but what are your indicators?
  2. What, if anything, did you do, way back when, to make it auto-login as root?
  3. And, for good measure, is there anything bad/detrimental to your cause, about it auto-logging in as root? Which tty is it auto-logging in on?
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)

azihsan
Posts: 8
Joined: Mon Apr 13, 2015 1:27 pm

Re: Auto login issue

Mon May 25, 2015 11:48 am

hello raTTus

Glad you reply my message, hope you will solve my problems with my bash script
so here my auto run script but has to be modified for some lines.

Code: Select all

#!/bin/bash

if ! pidof jackd &> /dev/null
then
  sudo killall ifplugd &> /dev/null
  sudo killall dhclient-bin &> /dev/null
  sudo service ntp stop &> /dev/null
  sudo service triggerhappy stop &> /dev/null
  sudo service ifplugd stop &> /dev/null
  sudo service dbus stop &> /dev/null
  sudo killall console-kit-daemon &> /dev/null
  sudo killall polkitd &> /dev/null
  killall gvfsd &> /dev/null
  killall dbus-daemon &> /dev/null
  killall dbus-launch &> /dev/null
  sudo mount -o remount,size=128M /dev/shm &> /dev/null
  echo -n performance \
| sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor &> /dev/null
  if ip addr | grep wlan &> /dev/null
  then
    echo -n "1-1.1:1.0" | sudo tee /sys/bus/usb/drivers/smsc95xx/unbind &> /dev/null
  fi
  jackd -P84 -p128 -t2000 -X alsa_midi -d alsa -dhw:1 -p512 -n2 -r44100 -s -P -Xseq \
&> /dev/null &
fi
the codes above is calling the jack to run before my synth can play. and it runs smoothly.
this is the second lines

Code: Select all

cd /home/pi/release
./sampler
this is the code that i intend to change directory in order to execute the sampler.exe.
the second lines dont seems to work, i dont know why, i heard that bash script can't do cd, how it can be solved?

and this is the third lines

Code: Select all

jack_connect sampler:output system:playback_1
jack connect sampler:output system:playback_2
jack_connect sampler:midi alsa_midi:midiKEY
because it is waiting for sampler to run, third lines cannot be execute if the sampler hasn't finished.

User avatar
RaTTuS
Posts: 10412
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Auto login issue

Tue May 26, 2015 8:04 am

read viewtopic.php?f=29&t=7192
then lets see
IMO
You don't really want to be doing sudo commands in a login script - do them in rc.local no need for sudo then.
as to why stop all those - why start them in the first place
anyhoo

bash can cd but you don't need to
just have

Code: Select all

/home/pi/release/sampler
instead
then if sampler [whatever it is] exists it will then run the jack_connect
if it does not exit then run it in the background like

Code: Select all

/home/pi/release/sampler&
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

Return to “Troubleshooting”