I'm using a Ubuntu 17.10 with Gnome Desktop installed. In my rc.local file I'm starting a java program that communicates with a TCP server. As soon as a certain sequence is received by this socket application, I would like to quit the currently running desktop and instead start a new one for the received user u. At the same time I don't want u to have to type in his password, just the way you don't have to when changing user to u by executing su u with root privileges.

Since my background service is started from rc.local, it has root privileges.

In my application I would like to execute a set of commands to achieve this, but I have no clue what to execute. My first approach was to kill x, log into tty2 as u and startx there, but I was not able to log a specified user into a given tty shell nor to execute a command in a given tty with the aid of a command. I tried openvt -c 2 -f -s -u u -- startx as I was suggested to do in this thread: Ubuntu log into certain tty shell as a distinct user, but this seems not to work the way I expected it to.

So to put it in a nutshell: How to start gnome desktop for a given user from rc.local bypassing the password validation?

I'm grateful for every kind of help. Best regards, Galveston01

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.