Difference between revisions of "Frontend Auto Login"
(→Note on Ubuntu (6.10): Replacement process for Ubuntu Edgy auto-login) |
(Format changes) |
||
Line 6: | Line 6: | ||
== inittab == | == inittab == | ||
Add the following line to your '/etc/inittab' file, | Add the following line to your '/etc/inittab' file, | ||
− | <pre | + | {{Box File|/etc/inittab| |
+ | <pre> | ||
c7:12345:respawn:/sbin/mingetty --autologin=mythtv tty7 | c7:12345:respawn:/sbin/mingetty --autologin=mythtv tty7 | ||
− | + | </pre> | |
+ | }} | ||
This is what will login the mythtv user. | This is what will login the mythtv user. | ||
Line 16: | Line 18: | ||
=== .bash_profile === | === .bash_profile === | ||
In that home directory, create/edit a .bash_profile file like this, | In that home directory, create/edit a .bash_profile file like this, | ||
− | <pre | + | {{Box File|.bash_profile| |
+ | <pre> | ||
if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty7 ]; then | if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty7 ]; then | ||
while [ 1 == 1 ] | while [ 1 == 1 ] | ||
Line 24: | Line 27: | ||
done | done | ||
fi | fi | ||
− | + | </pre> | |
+ | }} | ||
this will start X only if running on virtual terminal 7, so if you telnet or ssh | this will start X only if running on virtual terminal 7, so if you telnet or ssh | ||
into the box it will not react strange. It will also restart X if the frontend | into the box it will not react strange. It will also restart X if the frontend | ||
Line 33: | Line 37: | ||
==== No Window Manager ==== | ==== No Window Manager ==== | ||
− | For no windowmanager, create/edit the user's .xinitrc | + | For no windowmanager, create/edit the user's .xinitrc and add, |
− | <pre | + | {{Box File|.xinitrc| |
+ | <pre> | ||
xset -dpms s off | xset -dpms s off | ||
xsetroot -solid black | xsetroot -solid black | ||
Line 40: | Line 45: | ||
#mythtv-setup | #mythtv-setup | ||
#xterm | #xterm | ||
− | + | </pre> | |
+ | }} | ||
This will turn off dpms, turn the X default background color black, turn verbose logging on, and log everything to /home/mythtv/mythfrontend.log, this can be changed. Also included is an easy way to access mythtv-setup or xterm, just uncomment the appropriate line and comment out the mythfrontend line. | This will turn off dpms, turn the X default background color black, turn verbose logging on, and log everything to /home/mythtv/mythfrontend.log, this can be changed. Also included is an easy way to access mythtv-setup or xterm, just uncomment the appropriate line and comment out the mythfrontend line. | ||
Line 47: | Line 53: | ||
==== fvwm ==== | ==== fvwm ==== | ||
To use fvwm, edit your .xinitrc like, | To use fvwm, edit your .xinitrc like, | ||
− | <pre | + | {{Box File|.xinitrc| |
+ | <pre> | ||
xset -dpms s off | xset -dpms s off | ||
xsetroot -solid black | xsetroot -solid black | ||
Line 55: | Line 62: | ||
#mythtv-setup | #mythtv-setup | ||
#xterm | #xterm | ||
− | + | </pre> | |
+ | }} | ||
Next edit your .fvwm2rc, | Next edit your .fvwm2rc, | ||
− | <pre | + | {{Box File|.fvwm2rc| |
+ | <pre> | ||
# Submitted by Scott Elliott <selliott at insight.rr.com> | # Submitted by Scott Elliott <selliott at insight.rr.com> | ||
Style "*" RandomPlacement, DumbPlacement | Style "*" RandomPlacement, DumbPlacement | ||
Line 64: | Line 73: | ||
Style xmame* NoTitle, NoHandles, Sticky, WindowListSkip, SloppyFocus, GrabFocus, BorderWidth 0, StaysOnTop | Style xmame* NoTitle, NoHandles, Sticky, WindowListSkip, SloppyFocus, GrabFocus, BorderWidth 0, StaysOnTop | ||
Style mplayer* NoTitle, NoHandles, Sticky, WindowListSkip, SloppyFocus, GrabFocus, BorderWidth 0 | Style mplayer* NoTitle, NoHandles, Sticky, WindowListSkip, SloppyFocus, GrabFocus, BorderWidth 0 | ||
− | + | </pre> | |
+ | }} | ||
== Option 2 == | == Option 2 == | ||
If the above instructions don't give you results you like, there is another option to autologin. You can use inittab to login as the mythtv user and launch X all at once, without having to create a .bash_profile script. | If the above instructions don't give you results you like, there is another option to autologin. You can use inittab to login as the mythtv user and launch X all at once, without having to create a .bash_profile script. | ||
− | Find the following line in your /etc/inittab file: | + | Find the following line in your /etc/inittab file:| |
− | + | 6:2345:respawn:/sbin/getty 38400 tty6 | |
− | 6:2345:respawn:/sbin/getty 38400 tty6 | ||
− | |||
And comment it out by adding the "#" symbol in front of it: | And comment it out by adding the "#" symbol in front of it: | ||
− | + | #6:2345:respawn:/sbin/getty 38400 tty6 | |
− | #6:2345:respawn:/sbin/getty 38400 tty6 | ||
− | |||
Then add this line directly under the line you just commented out: | Then add this line directly under the line you just commented out: | ||
− | + | 6:2345:respawn:/usr/bin/openvt -fwc 2 -- /bin/su - mythtv -c /usr/bin/startx >& /dev/null | |
− | 6:2345:respawn:/usr/bin/openvt -fwc 2 -- /bin/su - mythtv -c /usr/bin/startx >& /dev/null | ||
− | |||
Note: you should test the command to verify that the the mythtv user is authorized to start the X server. If not, modify your /etc/X11/Xwrapper.conf file to include: | Note: you should test the command to verify that the the mythtv user is authorized to start the X server. If not, modify your /etc/X11/Xwrapper.conf file to include: | ||
− | + | allowed_users=anybody | |
This command starts X as the mythtv user, and will restart X automatically if MythTV crashes. This option has the advantage that if your distribution has a graphical boot sequence like Ubuntu, Red Hat, Mandriva, etc, then you won't see any text before Myth starts. It looks a little more professional. This also means that you don't have to create a .bash_profile script. Edit your .xinitrc file according to the directions above and you are done. | This command starts X as the mythtv user, and will restart X automatically if MythTV crashes. This option has the advantage that if your distribution has a graphical boot sequence like Ubuntu, Red Hat, Mandriva, etc, then you won't see any text before Myth starts. It looks a little more professional. This also means that you don't have to create a .bash_profile script. Edit your .xinitrc file according to the directions above and you are done. | ||
Line 94: | Line 98: | ||
First, edit your /etc/gdm/gdm.conf-custom file: | First, edit your /etc/gdm/gdm.conf-custom file: | ||
− | + | {{Box File|/etc/gdm/gdm.conf-custom| | |
− | + | <pre> | |
− | + | [daemon] | |
− | + | AutomaticLoginEnable=true | |
+ | AutomaticLogin=mythtv | ||
+ | </pre> | ||
+ | }} | ||
Next, create and edit .gnomerc in the user's home folder: | Next, create and edit .gnomerc in the user's home folder: | ||
Line 180: | Line 187: | ||
Fedora Core 6 uses a script to let you choose which login manager to use. If no default is given it uses xdm. You can set the default by creating a file called /etc/sysconfig/desktop and adding DISPLAYMANAGER="KDE" or DISPLAYMANAGER="GNOME". Once this file is there then you can set the auto login from within KDE like so: | Fedora Core 6 uses a script to let you choose which login manager to use. If no default is given it uses xdm. You can set the default by creating a file called /etc/sysconfig/desktop and adding DISPLAYMANAGER="KDE" or DISPLAYMANAGER="GNOME". Once this file is there then you can set the auto login from within KDE like so: | ||
− | + | # Click on the K menu. | |
− | + | # In the K menu, click on Control Center. | |
− | + | # When the control center screen appers there is a list of options to pick. Select the System option. | |
− | + | # The System menu will expand and give a list of sub menus - click on Login Manager. | |
− | + | # When the login manager is displayed there are tabs that you can select Appearance/Font/Background/Sessions/Users/Convenience. Click on the Convenience tab. | |
− | + | # Go to the Automatic Login box, you will see there is 2 check boxes and a drop down menu. Click Enable Auto-login. Select user from the drop down menu. | |
− | + | # Click the Apply button down on the bottom right. | |
− | + | # Close window. The automatic login process will take effect when you restart your computer. | |
− | |||
− | Appearance/Font/Background/Sessions/Users/Convenience. | ||
− | Click on the Convenience tab. | ||
− | |||
− | |||
− | Click Enable Auto-login. | ||
− | Select user from the drop down menu. | ||
− | |||
− | |||
− | |||
− | |||
[[Category:HOWTO]] | [[Category:HOWTO]] |
Revision as of 02:41, 21 March 2007
Part of a proper frontend system is having it automatically login as the mythtv user and loading mythfrontend. There are a variety of methods to do this. KDM allows for auto-login, but doesn't handle mythfrontend crashes well. The best method is to use inittab to login the user straight into mythfrontend.
Contents
Setup
First you will need to make sure you have mingetty installed. Next, make sure you have a dedicated user to run the mythfrontend with a home directory.
inittab
Add the following line to your '/etc/inittab' file, Template:Box File This is what will login the mythtv user.
Option 1
Now we will setup the mythtv user,
.bash_profile
In that home directory, create/edit a .bash_profile file like this, Template:Box File this will start X only if running on virtual terminal 7, so if you telnet or ssh into the box it will not react strange. It will also restart X if the frontend crashes.
.xinitrc
There are two options for .xinitrc, one will load a window manager, the other will not.
No Window Manager
For no windowmanager, create/edit the user's .xinitrc and add, Template:Box File This will turn off dpms, turn the X default background color black, turn verbose logging on, and log everything to /home/mythtv/mythfrontend.log, this can be changed. Also included is an easy way to access mythtv-setup or xterm, just uncomment the appropriate line and comment out the mythfrontend line.
You should note that running mythfrontend without a window manager is not a supported configuration. You may run into focus problems when trying to press buttons, enter text and generally use the system.
fvwm
To use fvwm, edit your .xinitrc like, Template:Box File
Next edit your .fvwm2rc, Template:Box File
Option 2
If the above instructions don't give you results you like, there is another option to autologin. You can use inittab to login as the mythtv user and launch X all at once, without having to create a .bash_profile script.
Find the following line in your /etc/inittab file:|
6:2345:respawn:/sbin/getty 38400 tty6
And comment it out by adding the "#" symbol in front of it:
#6:2345:respawn:/sbin/getty 38400 tty6
Then add this line directly under the line you just commented out:
6:2345:respawn:/usr/bin/openvt -fwc 2 -- /bin/su - mythtv -c /usr/bin/startx >& /dev/null
Note: you should test the command to verify that the the mythtv user is authorized to start the X server. If not, modify your /etc/X11/Xwrapper.conf file to include:
allowed_users=anybody
This command starts X as the mythtv user, and will restart X automatically if MythTV crashes. This option has the advantage that if your distribution has a graphical boot sequence like Ubuntu, Red Hat, Mandriva, etc, then you won't see any text before Myth starts. It looks a little more professional. This also means that you don't have to create a .bash_profile script. Edit your .xinitrc file according to the directions above and you are done.
Some may prefer this method of logging in and starting X to the method above because X prefers to use tty 7 and the method above may cause problems.
Note on Ubuntu Edgy (6.10)
As of Ubuntu Edgy, inittab is no longer an option for an automatic login setup. However, you can use Gnome to automatically login and run mythfrontend. Note that this option requires Gnome and X.
First, edit your /etc/gdm/gdm.conf-custom file: Template:Box File
Next, create and edit .gnomerc in the user's home folder:
touch /home/mythtv/.gnomerc chmod 755 .gnomerc
Now edit this file and add the following line:
sleep 10 && mythfrontend > /tmp/mythfrontend.log 2>&1 &
Option 3
Configure a Login Manager to login automatically as a default user. Then configure your desktop (KDE or GNOME) to autostart a program like mythfrontend. To deal with mythfrontend crashes, I would suggest that you run a wrapper around mythfrontend like
while true; do mythfrontend; sleep 5s; done
KDM Auto Login
For the default user, create a link in ~/.kde/Autostart that points either to the script listed above (or some other script that starts the front end) or merely to mythfrontend itself. The system will now log in automatically, and immediately start the frontend.
Frontend Auto Login with Fedora Core 5 and GNOME / GDM
To set GDM to auto-login your mythtv user, edit your GDM configuration:
vi /etc/gdm/custom.conf
Add the following lines to the [daemon] section:
[daemon] AutomaticLoginEnable=true AutomaticLogin=mythtv
Then, set the $HOME/.xsession file for your mythtv user to start mythwelcome:
vi ~mythtv/.xsession
An example, which will start the Metacity window manager, an xterm (which you can start with F12 from mythwelcome) and finally, mythwelcome itself.
Note: If mythwelcome dies for some reason, GDM will restart it.
#!/bin/bash metacity & xterm & mythwelcome
Make sure to make it executeable:
chmod 755 ~mythtv/.xsession
If you'd like to be able to login as a different user before GDM logs in your mythtv user, replace the AutomaticLogin lines in your GDM configuration with TimedLogin lines.
This example will wait 10 seconds before logging in the mythtv user.
[daemon] TimedLoginEnable=true TimedLogin=mythtv TimedLoginDelay=10
Frontend Auto Login with Kubuntu / KDM
To set KDM to auto-login your mythtv user, edit your KDM configuration:
sudo vi /etc/kde3/kdm/kdmrc
Go to (almost) the bottom of the file and edit the next lines:
[X-:0-Core] AutoLoginDelay=0 AutoLoginEnable=true AutoLoginUser=mythtv
Frontend Auto Login for Fedora and KDE
Fedora Core 6 uses a script to let you choose which login manager to use. If no default is given it uses xdm. You can set the default by creating a file called /etc/sysconfig/desktop and adding DISPLAYMANAGER="KDE" or DISPLAYMANAGER="GNOME". Once this file is there then you can set the auto login from within KDE like so:
- Click on the K menu.
- In the K menu, click on Control Center.
- When the control center screen appers there is a list of options to pick. Select the System option.
- The System menu will expand and give a list of sub menus - click on Login Manager.
- When the login manager is displayed there are tabs that you can select Appearance/Font/Background/Sessions/Users/Convenience. Click on the Convenience tab.
- Go to the Automatic Login box, you will see there is 2 check boxes and a drop down menu. Click Enable Auto-login. Select user from the drop down menu.
- Click the Apply button down on the bottom right.
- Close window. The automatic login process will take effect when you restart your computer.