Auto log on

Issues related to applications and software problems
Post Reply
megahertz
Posts: 10
Joined: 2012/05/21 14:33:34

Auto log on

Post by megahertz » 2012/05/30 20:45:28

I have built a server with Centos 6.2 OS.
I want to use this server as a file sever with authorization levels on a small office (24 Windows users).
My hardware is:
MB = Intel S1200BTL
CPU = Xeon E3-1220
Memory = 2x4G ECC
HD = 2x1T on BIOS RAID1
OS = Centos 6.2

I expect that the server works automatically, even after a power fail (yes, I do have UPS).

On the Intel S1200BTL BIOS setup, I've set it up so after a power failure it returns to previous state.
So on a auto boot it will stop on the log on screen. That is OK as Samba is loaded on start up for all users even before someone logs in.
But what about Power Management?
As I understood, every user has a personal Power Management script that is loaded when you log in.
After a auto boot, when it's waiting at the log on screen, what power management rules is applied?
As the office works only 8 hours a day I would also desire it to suspend and wake up on LAN, but as I read, WOL Is very complex to implement.

For now, I wold like to know how I auto log on a system user?

Regards,
Luiz
:-?

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Auto log on

Post by pschaff » 2012/05/30 21:49:42

Auto-login could be considered a severe security issue, and I doubt it is necessary for power management. I'm sure it can be done, but I don't know how and am not motivated to research it.

According to [url=https://access.redhat.com/knowledge/articles/7845]upstream[/url]:
[quote]The sleep, suspend, and hibernate power states are traditionally meant to be used on portable laptop or notebook systems, that is, systems with integrated batteries.As such, Red Hat tests and guarantees this feature only on supported laptop and notebook systems. Alternatively, Red Hat does not normally test sleep, suspend, and hibernate functionality on server, workstation, or desktop systems. While these power states may work on some non-portable systems, Red Hat does not guarantee this feature. [/quote]

Edit: I see you just posted the auto-login procedure. Be careful. :-)

megahertz
Posts: 10
Joined: 2012/05/21 14:33:34

Re: Auto log on

Post by megahertz » 2012/05/30 21:49:57

Fond the answer to auto log in (Centos 6.2) to a system user

Just edit /etc/gdm/custom.conf with your favourite editor. Then, under the [daemon] section, add 2 lines so it looks like the code below (obviously change username to the username you want to use)

[daemon]
AutomaticLoginEnable=true
AutomaticLogin=username

Regards,
Luiz
:-)

rojacos
Posts: 4
Joined: 2015/09/15 20:47:22

Re: Auto log on

Post by rojacos » 2018/04/19 22:43:10

Thanks Luiz - people like you make the world a better place to live in for a dev :0

Everyone assumes the whole world is in production mode all the time

flhtc
Posts: 21
Joined: 2007/08/23 19:01:42

Re: Auto log on

Post by flhtc » 2018/07/25 15:49:24

I know this is an old thread, but I'll beat a dead horse this time, in hope that it might help someone trying to do something similar.

Note that this was done in CentOS 6.5. Also, some of the files will get overwritten on subsequent OS updates. KEEP BACKUPS.
I do agree that autologin "could" be considered a security issue, If it's not done with security in mind.

I have machines on the shop floor that do one thing and one thing only. Collect data from gauges.

That said, When it boots, the user is logged in, the program starts, the data is collected. The programs are shell scripts that collect serial data from gauges. Nothing special.

If the users exits the program, they are automatically logged out by the exit command at the end of their profile. the autologin logs the back in, the program starts.. (I see a pattern here) etc...

There's no way for them to get to the OS. Well.. almost. All the tty's are disabled except 1 & 5. The user could hit Alt+F5 and get a login prompt. But that's not bypassing the login. It's only there so I can make changes on the floor.

I setup autolgin by adding a conf file in etc/init. Name it what you wish. just us the .conf suffix.
It contains this.

usernamehere.conf

Code: Select all

# tty - getty (you can tell where I stole this from ;)
#
# This service maintains a getty on the specified device.
stop on runlevel [S016]
respawn
instance $TTY
# exec /sbin/mingetty $TTY (Original line)
exec /sbin/mingetty --autologin usernamehere $TTY
The users login .profile (using KSH) contains this.

Code: Select all

HOSTNAME=`/bin/hostname`
PATH="$PATH:/util/"
umask 002
export TERM=xterm
setterm -blank 60 -powersave off -powerdown 15
cd /util/prog/version#
. ./global.cfg
/bin/ksh ./main-menu 
stty sane
exit

The TTY setup is like this
start-ttys.override

Code: Select all

#
# This service starts the configured number of gettys.

start on stopped rc RUNLEVEL=[2345]

env ACTIVE_CONSOLES=/dev/tty[1-6]
env X_TTY=/dev/tty1
task
script
  . /etc/sysconfig/init
  for tty in $(echo $ACTIVE_CONSOLES) ; do
    [ "$RUNLEVEL" = "5" -a "$tty" = "$X_TTY" ] && continue
    if [ "$tty" = "/dev/tty1" ]
    then
      initctl start lmi TTY=$tty
    elif [ "$tty" = "/dev/tty5" ]
    then
      initctl start tty TTY=$tty
    fi
  done
end script

Post Reply

Return to “CentOS 6 - Software Support”