Login to any tty without switch to it before logged

Share your own howto's etc. Not for support questions!

Login to any tty without switch to it before logged

Postby lbuiyzxl » 2017-10-31 07:36

Code: Select all
#!/bin/sh
VTX=$1
USERNAME=$2
export TERM=$3
kill -19 $(lsof -t -c 'agetty' -a /dev/tty${VTX}) 2>/dev/null;
openvt -c ${VTX} -f -- sh -c "clear;/bin/login -f ${USERNAME};kill -9 $(lsof -t -c 'agetty' -a /dev/tty${VTX}) 2>/dev/null"

Usage:
./scriptname vtx username linux

This script avoid some error than directly "agetty -a username ttyX linux" Linux.
That error of agetty is that target tty output error information similar following:
Code: Select all
bash: cannot set terminal process group ("random pid of login"): Inappropriate ioctl for device
bash: no job control in this shell

And also mad ask your login password.
I'm sorry for my bad English skills
I'm don't want to be a nuisance.
lbuiyzxl
 
Posts: 64
Joined: 2017-05-11 08:35

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable