Auto login

I need my system to autologin on a serial console when it boots. This system has no password, so if I could simply pass 'root' during boot, that would be enough. I have tried a few things, but the inittab/getty stuff is not cooperating. thanks

Reply to
tns1
Loading thread data ...

Try this, I used this successfully

formatting link

Ciao Marco Cavallini ============================================== Koan s.a.s. - Software Engineering (x86 and ARM) Linux and WinCE solutions for Embedded and Real-Time Software Via Pascoli, 3 - 24121 Bergamo - ITALIA Tel./Fax (++39) +35 - 255.235 -

formatting link
==============================================

Reply to
Marco Cavallini

Works great, thanks.

Reply to
tns1

So how do I execute different commands depending on where the login came from (same user in each case)?

Ideally this would be something in .bashrc that would let me launch one program if the login came from the serial console, and another if it was the main console, yet another if it was an ssh login. thanks

Reply to
tns1

It worked great until I had to add a password. Now it just asks for a password. The username part is still working. I don't understand since the app note did not mention anything about a password. Ideas?

Reply to
tns1

What password ? When ? I don't understand what is you behavior.

Reply to
Marco Cavallini

It turns out that the application note for performing an autologin works for two different situations:

1) For a normal user account 2) For root, but only if root has no password assigned My system originally had only the root account and no password, so the autologin worked fine. In a simple non-networked, non-secure embedded device this was OK.

I needed to add a password to add network and ssh support, and autologin to root no longer worked. The fix was to create a user account and have it autologin to the user account instead of root. Root access is still available with su.

Reply to
tns1

You need to rebuild your autologon (see previous example linked in this thread) changing the password like the one you set into the linuxbox.

int main() { execlp( "login", "login", "-f", "fred", 0); }

Good luck!

Marco

Reply to
Marco Cavallini

Why don't you simply use ssh private/public key auto login feature? That is, copy your root public key to .ssh in the target and you are all set (see ssh man page). I use this scheme both to login and scp to a development target. Haven't tried as root but as long as sshd is configured to accept root login I see no reason why it shouldn't work as well.

Regards.

Reply to
ih8sp4m

I don't think there is a way to do this for root. This example logs in normal user fred without having to supply his password. Try it for root and let me know if you were successful.

Reply to
tns1

I don't think this gets me what I need. I need a secure remote login which I can get with ssh. Its OK for the remote login to ask for a pwd, so that part is fine. I also need the local console to autologin on boot, and autoexecute an app with root priviledge. The only way I see ssh helping me here is if I remove the root pwd in /etc/passwd, but still have ssh require authentication. I will not be logging in from the same remote every time, if that makes a difference.

Another possibility is if only certain users are allowed to do remote login. Is this possible?

Reply to
tns1

Why not just specify the app in your /etc/rc script, and have it automatically executed that way?

Reply to
John Williams

This is what I originally tried, and may have to revisit it since I have pretty much exhausted my other options. The app needs to output to the local console, and it needs to provide an interactive menu if a user happens to be present. The autologin,autoexecute seems necessary to make this part happen. If I simply start the app as you say, the local console cannot interact with it, since it was not launched from there. Without root priviledge, the local console cannot stop and restart the app either.

What seemed so simple is proving to be a real challenge. It seems the only way to give a normal user the necessary rights is to change the UID to 0, but once that is done autologin wont work. Linux security is too smart for this app!

Reply to
tns1

Actually I am using the following source code (my root user has no password).

int main() { execlp( "login", "login", "-f", "root", 0); }

Ciao Marco

Reply to
Marco Cavallini

I see now that is it possible to prevent root login in sshd_config. Thats allows me to remove the root pwd.

Reply to
tns1

Here is what I am using for now: root has no pwd. ssh is set to prevent root login in sshd_config. I can now use the local autologin to root and autoexecute my app, or to a user who can su to root without a pwd and autoexecute my app. Not ideal but does satisfy the reqs. As long as the lan is secure thats all I need.

Reply to
tns1

Excuse me if I'm missing the point, but why not just specify the app in /etc/inittab and specify it to point to the serial port?

After all...how do you think that pesky 'login' program is being launched? ;)

Reply to
barry

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.