I always use more than one terminal, but always have to type login information in each one before using. How can I specify in inittab to only prompt for login info in tty1, and after successiful login automatically logon with the same user in all other virtual terminals?
-
For windows clients (also works on Linux, but the process is simpler as you just copy the key and your done) Public Key Authentication could get you close.
You setup up a key pair using ssh-keygen and then run the private key through putty-gen to get the key file into a putty format. Then you create a putty session with the settings you want and the host name, as well as the private key file you ran through putty-gen and save it. You can then use PAgent to automatically authenticate you. You can then just right click on the putty window and goto "Duplicate session" and you have a new terminal authenticated and ready to go (or use the pagent icon).
http://www.ualberta.ca/CNS/RESEARCH/LinuxClusters/pka-putty.html
It sounds like a pain, but it's really not. You setup most of it once (persists between shutdowns.) After that you put your password in once when you start PAgent, then just open the putty connection name (all done via a taskbar icon by the clock.)
If your really into automation you could setup a startup task to automate this further (you would be prompted once for a password):
http://hamisageek.blogspot.com/2009/01/pageant-with-your-ssh-provate-key-added.html
If your client is linux you might look at setting up a control master socket. It will ask for authentication once, and then all future connections use the socket. It makes connect times go to milliseconds vs about 2-3 seconds as well after the first login. http://www.linux.com/archive/feed/54498
ErikA : Good advice for ssh sessions. I believe the OP is asking about logging into the console directly, though, in which case keys won't help.From Josh -
Use an X terminal
From symcbean -
If you absolutely want to do that, here's an idea. Right now I don't have time to test my idea, but something like this MIGHT work:
1) Install
mingetty
if not already in use (it supports --autologin, so things like1:2345:respawn:/sbin/mingetty --autologin thiado --noclear tty2
should be possible2) Have a normal /etc/inittab and another one like /etc/inittab.autologin available. For your auto-login ttys, make /etc/inittab.autologin contain something like
2:2345:respawn:/sbin/mingetty --autologin thiado --noclear tty2 3:2345:respawn:/sbin/mingetty --autologin thiado --noclear tty3 4:2345:respawn:/sbin/mingetty --autologin thiado --noclear tty4 5:2345:respawn:/sbin/mingetty --autologin thiado --noclear tty5 6:2345:respawn:/sbin/mingetty --autologin thiado --noclear tty6
3) In your .bashrc or whatever test if 1) current tty is tty1 and if it is, 2) test if all the other ttys are already in use or not.
4) In case of successful login to tty1 replace your normal /etc/inittab with /etc/inittab.autologin and send HUP signal to mingetty to make it reload the configuration.
5) Profit! This should make autologin happen.
Another way instead of replacing /etc/inittab would be to make tty1 start with runlevels 1, 2 and 3 and all the others with only 4. Then you could switch to runlevel 4 every time you need all the ttys with command
init 4
, and make ttys disappear withinit 3
(or whatever your normal runlevel is).But, all this is nasty hacking at its best or worst. Don't try this at home and especially not at work. The
screen
mentioned here many times is a way better approach.From Janne Pikkarainen -
I have to agree with the first comments and use screen. The autologin method will work, but is really insecure. May be fine for home, but for a production system that's a big security no-no and would throw any secops person into a conniption fit. The other answers of using keys with putty or any other ssh client is good as well, but for direct console login I would go with screen.
From John -
Why do you need to use TTYs? Are X terminals not an option? I ask this because I know sometimes you must stay on those terminals (e.g. if using a Braille bar). Unless that's the case I'd strongly recommend using X and opening terminals from there. A lightweight window manager (a la ION3, AWESOME or the like: see here) will do the rest.
Chris S : Installing X and a Window Manager on a production server that requires neither is a terrible idea; especially so when `screen` would solve the problem.lorenzog : Chris, I agree. Except that nowhere in the original message it's specified that's a production server. And again, if it is, logging automatically on all TTYS might be a very very bad idea. Furthermore X won't do any damage unless you install some drivers that might interfere with the kernel. Just don't use it.From lorenzog
0 comments:
Post a Comment