LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (http://www.linuxquestions.org/questions/red-hat-31/)
-   -   RHEL 6 inittab (http://www.linuxquestions.org/questions/red-hat-31/rhel-6-inittab-4175422496/)

clcbluemont 08-16-2012 04:32 PM

RHEL 6 inittab
 
In RHEL 5 I use to be able to enter the following in the inittab file:
1:2345:respawn:/bin/su - joe "/usr/bin/startx"

I tried something similar in RHEL 6's /etc/init/tty.conf. It is not working. I need X to start at boot up under as a particular user. Ideas how I might accomplish this under RHEL 6?

kbp 08-16-2012 07:03 PM

Code:

perl -pi -e 's?^(exec\s+/sbin/mingetty\s+)(.*)?\1--autologin joe \2?' /etc/init/tty.conf
Then just add startx to ~joe/.bash_profile I suppose

clcbluemont 08-17-2012 10:08 AM

Lazy
 
Thank you, for your response. I must be getting lazy not to have looked at the mingetty man page, --autologin was right there.
I ended up with the following in the tty.conf file:
# tty - getty
#
# This service maintains a getty on the specified device.

stop on runlevel [S016]

respawn
instance $TTY
exec /sbin/mingetty /dev/tty1
exec /sbin/mingetty /dev/tty2
exec /sbin/mingetty --autologin idp /dev/tty3



and .bash_profile:
if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty3 ]; then
startx
fi

clcbluemont 08-17-2012 12:12 PM

Other suggestions
 
I ended up changing the tty.conf file to:

stop on runlevel [S016]

respawn
instance $TTY

exec /sbin/mingetty --autologin idp $TTY

This article and follow ups shows some other ways of doing this:
http://sudhaker.com/23/centos-rhel-6-autologin

colossalman 10-09-2013 04:10 PM

works for me!
 
Thank you for the .bash_profile snippet, I was wondering how I was going to restrict to one X session.


All times are GMT -5. The time now is 12:35 PM.