So Close: How to get this SSH login working (.bashrc)

Posted by This_Is_Fun on Server Fault See other posts from Server Fault or by This_Is_Fun
Published on 2011-01-31T04:32:56Z Indexed on 2011/01/31 7:27 UTC
Read the original article Hit count: 540

Filed under:
|

Objective: SSH login ( + eliminate warning message) / run 2 commands / stay logged in:

EDIT: Oops, I made a mistake (see below):

This code does ~95% of what I wanted to do

# .bashrc
# Run two commands and stay logged in to new server.
alias gr='ssh -t -p 5xx4x [email protected] 2> /dev/null "cd /var; ls; /bin/bash -i"'

Now, after successful login / verify user logged in =

root pts/0 2011-01-30 22:09

Try to 'logout' =

bash: logout: not login shell: use `exit'

I seem to have full root access w/o being logged into the shell? (The " /bin/bash -i " was added to 'Stay logged in' but doesn't work quite as expected) FYI: The question is "How to get this SSH login working" & it is mostly solved, sorry I made a mess...

...

..

.

Original Question Here:

# .bashrc
# Run two commands and stay logged in to new server.
alias gr='ssh -t -p 5xx4x [email protected] "cd /var; ls; /bin/bash -i"'

# (hack) Hide "map back to the address - POSSIBLE BREAK-IN ATTEMPT!"  message.
alias gr='ssh -p 5xx4x [email protected] 2> /dev/null'

Both examples 'work' as shown; When I try to add the ' 2> /dev/null ' to the first example, then the whole thing breaks.

  • I'm out of time trying to solve the warning message other ways, so is it possible to combine both examples to make example #1 work w/o the warning message?

Thank you.

ps. If you also know a proper way to kill the login warning message, please do tell (the 'standard' "edit host file" advice isn't working for me)

© Server Fault or respective owner

Related posts about ssh

Related posts about bashrc