Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to have PuTTY automatically run screen -RD when I log in, however I would like if possible, for this to be either configured as part of PuTTY, or for the server to identify when a PuTTY user is connected and force screen -RD.

I don't wish for this to happen from other boxes, as I don't particularly want this to affect certain automated processes from needing to worry about whether screen -RD is already busy and unable to accept commands.

Thanks!

share|improve this question

migrated from serverfault.com Jul 25 '11 at 16:55

This question came from our site for professional system and network administrators.

2 Answers 2

up vote 4 down vote accepted

The option is under Connection->SSH in PuTTY's options. Just put screen -RD in the remote command field and it'll be executed.

A word of warning: be sure that's really the combination of options you want; as it is that'll close any session you already have open. You may want to use -Rd or have some logic based on grepping screen -list's output.

Putty Settings

share|improve this answer
    
Awesome thanks :) Feel like a bit of a dumbass for asking now, thought I'd trawled PuTTY options embarrassed –  DanH Jul 26 '11 at 2:06
    
How do I keep the session open (and also see the output of the commands) once they are executed? This seems to close the session as soon as the commands are executed. Not very useful when you just want to run some client-initiated commands automatically but continue using the shell. –  ADTC Jan 11 at 10:08

I solved this issue server-side when I realized that there was never an instance that I wanted a terminal that wasn't a screen terminal. I added screen -aAxRUO to my ~/.profile so that any SSH connection to that system (or shell that I open) instantly re-connects to my screen session (without disconnecting the other shells I might have open) or creates a new screen session if it doesn't automatically exist.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.