0

I try to start an x server for a certain user on tty5 as root user from tty6. My approach was to log into tty5 as a specific user from command line tty6. Then I would just chvt to 5 and startx there. Problem is, I have no clue how to login a certain user in a specified tty.

So to put it in a nutshell: Is there a command to change to a certain tty and login there as a distinct user from another tty using root privileges?

Or can I just startx for a specified user and virtual terminal?

Edit: I want to use root privileges to login the specified user so that the password ist not asked for.

1 Answer 1

0

You can use openvt command. From man page:

openvt [-c vtnumber] [OPTIONS] [--] command

-c, --console=VTNUMBER

-s, --switch

-u, --user

So you can login and switch to desired tty, and run program automatically.

1
  • Already tried this. It always opens a new tty, whereas I want to access the already existing tty5. Furthermore, although passing a user using the -u parameter, when executing whoami in the new tty it returns the user who opened the new tty (not the one who was passed). Note: I executed sudo openvt -s -u tester -- startx from tty5 and tty n opens. Edit: Passing a command to be executed using -- [command] does not work either Commented May 4, 2018 at 16:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .