Hi,
using ssh [putty], i login to this server [server1]
being on this server, i would like to connect to server [server2] so i did the following:
mike@server1:~/tmp> ssh mike@server2 echo test >> /tmp/mike.txt
the above didn't complain and executed
on server2, i can not find mike.txt file under /tmp
can someone help pls?
thanks
Scott
2
But you should find it under /tmp on server1.
Try quoting the command (including the redirection) to make the whole thing run on server2:
ssh mike@server2 "echo test >> /tmp/mike.txt"
1 Like
Thanks. it works with ""
instead of coping the file, now i have to execute a command on server2. i did the following but nothing start on server2
mike@server1>ssh mike@server2 ". ~/.profile /local/home/mike/software/bin/start"
any help would be really appreciated
Scott
4
Does ~mike/.profile on server2 accept arguments?
/local/home/mike/software/bin/start is one in the example you quote.
Local Command (ssh) Remote Command Args to Remote Command
| | |
| | |
-------------------- ---------- -----------------
mike@server1>ssh mike@server2 ". ~/.profile /local/home/mike/software/bin/start"
Perhaps you meant:
mike@server1>ssh mike@server2 ". ~/.profile && /local/home/mike/software/bin/start"
or
mike@server1>ssh mike@server2 ". ~/.profile; /local/home/mike/software/bin/start"
Furthermore, what is /local/home/mike/software/bin/start? Is it a daemon? Does it live on when you logout of server2 normally?
1 Like
I haven't tried the corrected syntax which you have provided. Thats no a daemon. its a script which start something.
The goal is:
1) connect to server2
2) cd to this location /local/home/mike/software/bin
3) run this command "start"
.profile is a file on a server which contains env variables with full path. one of the env variable in .profile is as follows
dir=/local/home/mike/software/bin
Thanks,