Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 root@9x.1xx.51.00 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 root@9x.1xx.51.00 "cd /var; ls; /bin/bash -i"'

# (hack) Hide "map back to the address - POSSIBLE BREAK-IN ATTEMPT!"  message.
alias gr='ssh -p 5xx4x root@9x.1xx.51.00 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)

share|improve this question
    
Fix the warning message. The warning message tells you the exact line in authorized_keys you should delete so that it disappears (given that you acknowledged the warning, and the server key really changed). –  Juliano Jan 31 '11 at 4:42
1  
How are you adding the redirection to the first command and in what way does it break? –  Dennis Williamson Jan 31 '11 at 4:45
    
@Juliano Not that type of warning; This one is related to the hostname/ IP & I'm using a VPS (no control over the true server root), so far unable to fix... "Check dns" is off in ssh config. @Dennis Will update ASAP. –  This_Is_Fun Jan 31 '11 at 5:03
    
@Dennis Good point, thanks. I was online 'too long' and had made an error. My original post is edited now. –  This_Is_Fun Jan 31 '11 at 5:23

1 Answer 1

up vote 1 down vote accepted

You're getting the bash: logout: not login shell: use 'exit' message because you started an interactive non-login shell. Try bash -l or bash -il instead.

share|improve this answer
    
Working great now, thanks Dennis. –  This_Is_Fun Jan 31 '11 at 7:08

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.