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.

I want to define bash functions and aliases in my remote shell automatically on login. I can't put the definitions into .profile or similar because the users I log in as are often shared with others who use the same systems and I don't have control of this. What I'm trying to do is execute a few bash function definitions in the remote process and then continue as a login shell. I tried this but it did not work:

cat ~/.profile - | ssh -tt user@host bash -l

Any ideas?

share|improve this question
1  
This should help: serverfault.com/questions/79645/… –  Jason S Jun 9 '12 at 14:55
    
Thanks, that is what I was looking for. –  Ramon Jun 9 '12 at 16:52
    
Great! Glad it helped. DFTBA! :) –  Jason S Jun 9 '12 at 18:00

1 Answer 1

If you have permission, you could also modify the .bashrc or .bash_profile on the destination server to do a 'whoami' check and only run those alias and function settings if it matches your username.

Personally, I'd go with the Expect option, but it can be quite an exercise in frustration if not you're not already conversant with Expect.

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.