I'm pretty new to SSH and such, so I'm not sure how to do this. I can ssh into the server pretty easy:
ssh uuid#appname-domain.rhcloud.com
and cd into the data directory:
cd app-root/data
But I'm not sure where to go from there. Any help would be appreciated. Thanks!
I use Winscp for windows. Here is post about the subject from openshift.
https://www.openshift.com/forums/openshift/copying-files-to-server
If you have an scp command line utility installed, you can use the rhc scp command
Related
I am trying to download a large number of files from a remote Ubuntu Server to my machine which is also running on Ubuntu. I am using SCP protocol as below:
for i in *; do $i sshpass -p 'Remote_Server_Passcode' scp root#<Remote_Server_IP>:'/opt/Data/' .; done
This is failing with an error message saying command not found
Any help pointing towards right direction will be highly helpful.
Thanks
If I understand correctly you just want to copy the whole /opt/Data directory, this can also be achieved like this:
scp -r root#<Remote_Server_IP>:/opt/Data/ .
-r means recursive
And as to what was going wrong the for i in *; do $i loops through all files in the current local directory and then tries to execute those, which is probably not what you wanted.
Something like
ssh root#host "ls -l"
works fine
But when I'm trying
ssh root#host "showrgst"
I'm getting "command not found". And yes, I don't have showrgst command on the host I'm connected from.
How to solve this?
you need to install showrgst in the remote server and make sure the PATH env variable has the path to showrgst.
firstly, you can locate what executable is for this command
$ which showrgst
for example, it is executable script from $HOME/bin/showrgst.
So, you need to copy this file to server by means of scp -
$ scp ~/bin/showrgst youserver.com:/home/username/bin/
if this command is executable of some package existing in repositories linux disto, you can install this on your server
I've started editing files over ssh/scp with vim, and it works pretty good.
So given that this can be done; is there any way to use SSH / SCP to load a remote repository into gitk locally?
I tried gitk scp://root#192.168.XXX.XXX//home/demo but I just end up with a dialog that reads Cannot find a git repository here.
Or you can run the gitk on remote server, if you enable X11 Forwarding, if it is enabled and gitk installed on you server.
ssh -X root#192.168.XXX.XXX "cd /home/demo; gitk"
Even though it is not what you asked, it might help you:
You could simply mount it with sshfs.
sudo sshfs -o allow_other,\
IdentityFile=/home/ysragh/.ssh/id_rsa \
yzzi#wow2d.development.yggdrasil.group:\
/opt/wow2d /home/ysragh/wow2d
And then you can use Vim and/or gitk in your home directory as if you downloaded it :)
I'm doing this like all the time when developing with virtual machine images :)
I am reading Michael Hartl's "Ruby On Rails 3 Tutorial" and have come to the point where I am pushing my first_app to Github. When I first tried this I got the error "Permission denied: (publickey). I thought the problem was I did not have a SSH keypair for Github. So in following their advice for generation a new keypair from the URL https://help.github.com/articles/generating-ssh-keys
I typed in
ssh-keygen -t rsa -C "your_email#youremail.com"
To which I received the error
"ssh-keygen is not recognized as an external or internal command, operable program, or batch file."
I am using Windows 7 OS. So I think my problem is that this command line entry is for Mac or Linux based command lines. Can someone please tell me the Windows 7 OS equivalent of this entry, so that I can create a new SSH keypair and continue on with the tutorial?
Flip the url to windows-specific:
https://help.github.com/articles/generating-ssh-keys#platform-windows
and note that they say to "Open the GIT bash", not the windows CMD.
ssh-keygen is part of Openssh package which you can install separately (Look for CopSSH for Windows, which is a Windows port of OpenSSH).
The first step is installing open-ssh, one way is indeed by installing Git for Windows. During the installation choose the third option of being able to use the "unix" tools from the command line.
I have a small wrapper utility that loads the agent to memory in github (#selfplug) and your identities, allowing an easy use from the command line.
I want to run a script remotely. But the system doesn't recognize the path. It complains that "no such file or directory". Am I using it right?
ssh kev#server1 `./test/foo.sh`
You can do:
ssh user#host 'bash -s' < /path/script.sh
Backticks will run the command on the local shell and put the results on the command line. What you're saying is 'execute ./test/foo.sh and then pass the output as if I'd typed it on the commandline here'.
Try the following command, and make sure that thats the path from your home directory on the remote computer to your script.
ssh kev#server1 './test/foo.sh'
Also, the script has to be on the remote computer. What this does is essentially log you into the remote computer with the listed command as your shell. You can't run a local script on a remote computer like this (unless theres some fun trick I don't know).
If you want to execute a local script remotely without saving that script remotely you can do it like this:
cat local_script.sh | ssh user#remotehost 'bash -'
It works like a charm for me.
I do that even from Windows to Linux given that you have MSYS installed on your Windows computer.
I don't know if it's possible to run it just like that.
I usually first copy it with scp and then log in to run it.
scp foo.sh user#host:~
ssh user#host
./foo.sh
I was able to invoke a shell script using this command:
ssh ${serverhost} "./sh/checkScript.ksh"
Of course, checkScript.ksh must exist in the $HOME/sh directory.
Make the script executable by the user "Kev" and then remove the try it running through the command
sh kev#server1 /test/foo.sh