12-15-05 11:05 PM
On 15 Dec 2005 09:56:29 -0800 yezi <ye_line@hotmail.com> wrote:
| Subject: Re: How to set up to allow local root login in Linux ?
|
| rt.
|
| Thanks
I do it by putting the following in /etc/inittab, replacing an existing
tty entry:
=====<CUT HERE>=========<CUT HERE>=========<CUT HERE>=========<CUT HERE>====
=
#---------------------------------------------------------------------------
--
# Define console logins to start.
# If you cannot trust your physical security, do not use autologin.
#---------------------------------------------------------------------------
--
c1:12345:respawn:/sbin/agetty -n -l /etc/autologin 38400 tty1 linux
# c1:12345:respawn:/sbin/agetty 38400 tty1 linux
=====<CUT HERE>=========<CUT HERE>=========<CUT HERE>=========<CUT HERE>====
=
as well as:
=====<CUT HERE>=========<CUT HERE>=========<CUT HERE>=========<CUT HERE>====
=
#---------------------------------------------------------------------------
--
# Define serial port logins.
# If you cannot trust your physical security, do not use autologin.
#---------------------------------------------------------------------------
--
s0:12345:respawn:/sbin/agetty -n -l /etc/autologin 9600 ttyS0 vt100
# s1:12345:respawn:/sbin/agetty -n -l /etc/autologin 9600 ttyS1 vt100
# s0:12345:respawn:/sbin/agetty 9600 ttyS0 vt100
# s1:12345:respawn:/sbin/agetty 9600 ttyS1 vt100
=====<CUT HERE>=========<CUT HERE>=========<CUT HERE>=========<CUT HERE>====
=
Then I have this script named "/etc/autologin":
=====<CUT HERE>=========<CUT HERE>=========<CUT HERE>=========<CUT HERE>====
=
#!/bin/bash
pid="$$"
dev=$( /usr/bin/find "/proc/${pid}/fd/0" -maxdepth 0 -type l -printf '%
l\n' )
tty=$( echo "${dev}" | /usr/bin/cut -d / -f 3 )
speed=$( /usr/bin/stty -a | /usr/bin/head -1 | /usr/bin/cut -d ' ' -f 2 )
if [[ -x "/etc/autologin-${tty}-OK" ]]; then
echo ""
echo "Welcome to `exec uname -s` `exec uname -r`."
echo ""
echo "`exec uname -n` login: root"
echo "Password:"
cd /root
export AUTOLOGIN=1
export AUTOLOGIN_DEV="${dev}"
export AUTOLOGIN_TTY="${tty}"
export AUTOLOGIN_SPEED="${speed}"
exec /bin/su -
fi
if [[ -c "${dev}" ]]; then
exec /sbin/agetty "${speed}" "${tty}" linux
fi
echo "Unable to enable console ${dev}"
if [[ -x /bin/sleep ]]; then
exec /bin/sleep 3600
fi
exec /usr/bin/sleep 3600
=====<CUT HERE>=========<CUT HERE>=========<CUT HERE>=========<CUT HERE>====
=
Then I touch the following files into existance:
/etc/autologin-tty1-OK
/etc/autologin-ttyS1-OK
Your mileage may vary, but mine gets me there.
--
----------------------------------------------------------------------------
-
| Phil Howard KA9WGN | http://linuxhomepage.com/ http://ham.org/
|
| (first name) at ipal.net | http://phil.ipal.org/ http://ka9wgn.ham.org/
|
----------------------------------------------------------------------------
-
[ Post a follow-up to this message ]
|