Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Login to any tty without switch to it before logged

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Post Reply
Message
Author
lbuiyzxl
Posts: 66
Joined: 2017-05-11 08:35

Login to any tty without switch to it before logged

#1 Post by lbuiyzxl »

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.

Post Reply