Tuesday, May 7, 2013

add additional logins (ttys) to ubuntu OS and make them auto-login as any user without password

I like ubuntu, I hate the default terminal setup. This shows how to change from this:

Terminal Sessions: 
        ALT+F1 to ALT+F6 (tty1,tty2,tty3 ... tty6)

Graphical Sessions:  
        ALT+F7, ALT+F8, ALT+F9 ... etc 

to this:

Terminal Sessions:
         ALT+F1 to ALT+F12  = tty1 thru tty12

Graphical Sessions:
        SHIFT+ALT+F1 to SHIFT+ALT+F12 

* when using the above keystrokes remember to also press CTRL
  if you are already in a GUI window (this applies to both GUI
  keys and text terminal keys!)

This gives you 12 text terminals AND 12 GUI terminals PLUS
it is really easy to remember (i get tired of accidently pushing ALT+F7 when i mean to press ALT+F6 or vice versa, then the GUI requires you  to use CTRL+ALT+F6 to get back to it. This is much easier I think, and here's how to do it (this works on Ubuntu 12.04, 12.10 and 13.04 and may work with other versions as well). The steps are:

1) get to a terminal where you can log in as root. If you cant log in as root you will need to put "sudo" before all the commands in these instructions. If you just installed and cant log in as root but want to, heres how to enable the root account:
login with your usual username/password, at the prompt type "sudo su root" (enter YOUR password at the prompt if asked), at the next prompt type 'passwd' and you will be prompted to create a password, when done you can type 'exit' to get back to your account, now you can login as root using that password you just created! Now that you are logged in, go to the next step...

2) to change to the upstart configuration directory type:

   cd /etc/init

3) here you will need to copy the existing terminal configuration files to new ones for the new terminals youre about to create for tty7,8,9,10,11 and 12.

4) copy the new files by typing:

  for (( i=7; i<=12; i++)); do cp tty1.conf tty${i}.conf; done

5) now you need to edit each of the new files you just copied. If you don't have an editor install this recommended one called nano by typing:

  apt-get install -y nano

  You can do this easily in nano (or something simmilar) by typing:

  nano tty7.conf tty9.conf tty10.conf tty11.conf tty12.conf

  NOTE: if nano complains about not having multiple buffer mode, you will either need to enable it or edit them one by one!

6) for each configuration file you will need to change the text 'tty1' to whatever tty the current file's intended for (for example change tty1 to tty7 when editing tty7.conf)

      search: tty1
replace with: filename (without the .conf, for example 'tty7')

6a) (optional) If you want auto-login for any particular terminal, you can make this change causing an auto-login instead of a prompted login even after exiting:

      search: "exec tty<n> -8 38400" 
replace with: "exec tty<n> -8 38400 -a <username>"

  (where <n> is the tty number you are changing and <username> you want to log in as (no password prompt will be given).

7) if you're using nano, just press CTRL-O to save, and CTRL-X to close the buffer. 


That's all! Now you can reboot using CTRL+ALT+DELETE or type 'shutdown -r now' at a prompt. The next time you boot, all your terminals will log in automatically (if step 6a was followed) and will be on the keys mentioned above, 12 text terminals ready to go!! BTW, the 12t-12gui setup i think should the default when installed on any system that has more than 1GB of internal memory. getty does NOT take that much CPU time since "sleeping" is almost the same as not running at all 'cept for the swap space/mempage used.

NOTICE: I strongly suggest not auto-login as root -- personally I dont believe in using root for anything except emergency situations where other accounts arent available and/or sudo cant be run. If sudo doesnt work the way you expect it to, you probably just need to use 'sudo -H' instead, some programs check the $HOME folder for their configuration (not the $USER's HOME folder). Keep root disabled as well as it can lead you to cause much damage to your computer. If you hate entering in 'sudo' all the time just alias command='sudo command' in your bashrc file. Oh yeah, and I purposely didnt tell you that everything above is under a bash shell, just to see if you are paying attention!! sorry :) But above all, do not use root(!), and REALLY DONT X as root(!!!) and REALLY REALLY REALLY dont start any web browser as root(!!!!!!!!!)

linux is powerful if you know how to use it, for example, i can set up my terminal to show the current outside temperature and wind speed right in my prompt, as well as just about any other info available on the internet in any protocol...!! dont let windows users tell you that KDE and cygwin run stuff just like linux in windows and dont believe that WUBI is an honest representation of Ubuntu's performance... I think they are supposed to get rid of WUBI as of 13.xx anyway, so that is one step in the right direction... last thing we need is a bunch of ex-windows users here right? (points the finger at herself). Damn ranting, gotta go! -o

No comments:

Post a Comment