문제

I'd like to login to a remote machine, and mount my home dir there with a single command. I tried to do it with:

echo myPassword | tee "sshfs boriskh@85.143.104.141:/share/home/boriskh /home/boris/Work/molDyn/boriskh@hpchead" | ssh -Y boriskh@85.143.104.141 

but it doesn't work. tee says that it doesn't know the -Y option, and if quote both commands - it also works wrong.

Edit:

I found that these thiings put separately also don't work:

echo myPassword | ssh -Y boriskh@85.143.104.141
echo myPassword | sshfs boriskh@85.143.104.141:/share/home/boriskh /home/boris/Work/molDyn/boriskh@hpchead

Edit2:

To get the required functionality (mounting the remote home and also login there - in a single command with no password prompts) can be easily achieved with keys (with no passphrase - i.e. input Enter as a code):

ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub boriskh@85.143.104.141

That's it. After that the desired functionality is achieved with:

sshfs boriskh@85.143.104.141:/share/home/boriskh /home/boris/Work/molDyn/boriskh@hpchead && ssh -Y boriskh@85.143.104.141
도움이 되었습니까?

해결책

I think that for that task it should be more comfortable and secure use public keys. It's really easy and there are lot of tutorials.

Remember not put anything in the passphrase, or it will be like have to type the password.

다른 팁

I agree with Francisco Puga. But sometimes you really have to do things like this (dirty) and the solution is expect

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top