Re: howto do automatic login to runlevel 3?



Eric wrote:
Eric wrote:

I'm doing some special testing - i need to have the system boot and
automatically login to run level 3 (not 5) and execute a program. The
system is on a small isolated local network and will need network
communications to 3 other machines, so init 1 is out
so - how do i do automatic root login at runlevel 3? and where do i put a
call to my test program to auto-start it
Thanks
Eric

Well, here's the problem. I'm finding that there are differences if i run a
program from S99local as compared to logging in as root and then running
it. for example - the path isnt set. Also, i get random Hangup messages
from the shell during my program if i run it from S99local - i dont see
those when running after i login. Perhaps i need to source root's .bashrc
and a few other files?

It should be enough to source the /root/.bashrc


another way could be to compile this small program

--- autorootlogin.c ---
int main() {
execlp( "login", "login", "-f", "root", 0);
}
--- eof ---

Then edit your /etc/inittab ans select on which virtual terminal you want the root to be logged in, say you want to it be vt6, then change the line:
c6:12345:respawn:/sbin/agetty 38400 tty6 linux

to look like:
c6:12345:respawn:/root/autorootlogin

Now edit your /root/.bashrc to execute the program you want to run.

This isn't anything I would recommend you to do, as you will get trouble when you login as root for other reasons or use su. This can be useful if you want to run something as unprivileged user, like mythtv/freevo, just switch the "root" to the username you want to login as in the small c program.


//Aho
.



Relevant Pages

  • SUMARY: Cant login as root
    ... As a result, i was not able to log in as root, neither create a new ... Asunto: RE: Can't login as root ... > console. ... > If we log as any other user everythig is ok, but we cannot either do su-. ...
    (Tru64-UNIX-Managers)
  • Re: Unable to su as a user, I get: Cannot execute /bin/bash: Permission denied
    ... on the xconsole screen..it lets me login and then bounces me ... execute /bin/bash: Permission denied ... It'll be executed by the user, not root. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • RE: Urgent help needed with Login problems after installation of FC1
    ... symptom trying to su back to root. ... After another minimal install, I was able to add my user and su to it and su ... I was unable to boot using the boot floppy. ... I did a minimal install and was able to login as root, ...
    (Fedora)
  • Re: BSM, SSH, and Session ID
    ... Are you logging in as root through ssh or is that just the way it is ... Sun SSH/OpenSSH should fork off before the login because the sshd ... It should always be a different session, ...
    (Focus-SUN)
  • Re: Urgent help needed with Login problems after installation of FC1
    ... login would do anything but loop back to the Login: ... >From Gnome desktop, I was able to logout user, login root, over and ... Am able to boot from floppy. ... >After another minimal install, I was able to add my user and su to ...
    (Fedora)