You are not logged in.

#1 2022-04-28 12:24:14

flump_cliff_kumquat_fox
Member
Registered: 2022-04-27
Posts: 11

Executing command (screen) right after SSH login

Hi, I'm trying to start a screen session automatically right after I log into a server. I thought it was possible like this:

ssh -i [KEYFILE] [USER]@[HOST] "screen -d -r"

But this snippet logs out instantly after execution with the error "Must be connected to a terminal".

This is possible with PuTTY, but that application is janky to say the least.

Is this possible using only the standard CLI?

Offline

#2 2022-04-28 12:50:33

-thc
Member
Registered: 2017-03-15
Posts: 486

Re: Executing command (screen) right after SSH login

Please try

ssh -t -i [KEYFILE] [USER]@[HOST] "screen -d -r"

Offline

#3 2022-04-28 12:53:38

flump_cliff_kumquat_fox
Member
Registered: 2022-04-27
Posts: 11

Re: Executing command (screen) right after SSH login

Much appreciated, I've spent days searching for a solution. I guess the manpage had the answer all along. Thank you for your time.

Last edited by flump_cliff_kumquat_fox (2022-04-28 12:56:43)

Offline

#4 2022-04-28 12:55:19

-thc
Member
Registered: 2017-03-15
Posts: 486

Re: Executing command (screen) right after SSH login

You're welcome.

Offline

Board footer

Powered by FluxBB