Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there any way to specify, in .ssh/config, a command like:

ssh -t remote-host "screen -dR screen_name"

so I can easily access the remote screen session with ssh remote-host?

Right now I solved this problem using a custom script:

$ cat ~/bin/sssh 
#!/bin/sh

/usr/bin/ssh -t $1 "screen -dR ab"

~/bin stays first at $PATH, but it is unflexible and ugly.

Also I would like to find way to implement host autocompletion for my custom script.

share|improve this question
add comment

1 Answer

I'd argue that this is the most flexible way. A script allows you to set up parameters, add conditionals, change the command as needed, all based on the inputs.

There are ways to "force" the command in authorized_keys. But I don't know of a way to force tty allocation except from the command-line or to force a command on the remote server from the local side config files.

Myself, I have a script that scans the config file, checks against DNS with various domains and sets the terminal emulator's title string. I call it from screen on my local system (Ctrl-a g).

share|improve this answer
add comment

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.