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've just found a one liner to mirror a local mysql database on a remote server, over ssh:

mysqldump -uroot -proot zedatabase | ssh -p4551 geek@12.34.56.78 "mysql -udoom -pmySqlPassword zedatabase"

This is very handy, but something intrigues me:

is it secure to pass the mysqlPassword in the command? (But if I just leave the -p mysql option without explicit password, the command doesn't work)

What are the risks there, I mean, I know that someone which has access on my local machine will be able to access the password through the history;

but apart of that, can anyone else capture the output of the command (with a middle man attack or something like that), or is it ssh encrypted?

share|improve this question
1  
If someone managed to mount a man-in-the-middle attack against you, whether that's encrypted or not is moot - they see all the traffic in clear (including your complete database content). –  Mat Dec 1 '13 at 9:38
    
What if I only use public key authentication, it seems that mitm attack are ineffective against that type of authentication: stackoverflow.com/questions/4529530/… In this case, the attacker would still see the database dump, but not the mysqlPassword of the remote database ? –  ling Dec 1 '13 at 10:34
    
"I know that someone which has access on my local machine will be able to access the password through the history" you can add whitespace at the beginning of the command –  ALex_hha Dec 1 '13 at 10:51
    
Thanks, I didn't know that –  ling Dec 1 '13 at 11:30

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.