免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1370 | 回复: 0
打印 上一主题 下一主题

自动登录solaris [复制链接]

论坛徽章:
1
2015年迎新春徽章
日期:2015-03-04 09:54:45
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-12-29 10:36 |只看该作者 |倒序浏览
Automatic login at boot time on Solaris 2.x
Write a script that sets appropriate envoronment variables, opens
stdin
and stdout and stderr, and does whatever 'init' used to do for
'getty'.
Call this program from inside 'inittab' with an appropriate label and
at
an appropriate level.
I ended up creating the following entry in /etc/inittab which calls the
script that follows.
mp:34:wait://auto_login >/dev/console
2/dev/console
set USER =
# Verify that our user exists.
set exists = `ypmatch $USER passwd >& /dev/null`
if ( "$exists" == "" ) then
set exists = `grep "^^$USER" /etc/passwd`
if ( "$exists" == "" ) then
echo "Could not locate $user in either the NIS passwd map or"
echo "/etc/passwd. Without this user, the SW loaded"
echo "in ${HOME} cannot run."
echo "Please check that the installation completed successfully."
exit 1
endif
endif
# see if dtlogin session is already running - if so stop it
set dtrunning = `ps -eaf | grep dtlogin | grep -v grep | head -1 | awk '{
print $2 }'`
if ( "$dtrunning" != "" ) then
/etc/init.d/dtlogin stop
endif
# The following line changes the ownership and mode of files (like /dev/fbs
# and /dev/kbd) that OpenWindows uses. By default, these files have a
# permission of 0600 and are owned by root. Normally, login(1) sets these
# permissions and modes however... as usual we are not normal. This is
# necessary for OpenWindows to run for a non-root user.
#
/usr/bin/chown $USER /dev/console /dev/kbd /dev/fbs/* /dev/sound/*
/dev/mouse >& /dev/null
# Now launch OpenWindows as the non-root user
# Note that this will cause the error message "can't access tty - no job
control for
# this shell" when the program runs. This is normal and will not cause any
problems
# with running the system.
su - $USER
# Done.


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/894/showart_64051.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP