2

I just created an account on openshift https://www.openshift.com/ and successfully added my local system's public key to this account and I'm able to login through ssh by using this command user@user$ ssh <some_weird_string/hash>@pythonapp-eric.rhcloud.com

but when I tried to copy a file from my local, I got permission denied error

user@user$ scp Desktop/test.py <some_weird_string>@pythonapp-eric.rhcloud.com:/

<some_weird_string> is same for scp and ssh.

(And also I'm not allowed to use sudo command on openshift. I tried to install tree utility by this commmand sudo apt-get install tree but I got this error bash: /usr/bin/sudo: Permission denied)

however pip is working perfectly. I installed requests module pip install requests.

but how could I SCP. and is there any trick to use sudo on that machine?(though I'm not concerned about sudo) but I must be able to copy file from local to openshift.

PS: I've tried

scp Desktop/test.py <some_weird_string>@pythonapp-eric.rhcloud.com:

scp Desktop/test.py <some_weird_string>@pythonapp-eric.rhcloud.com:~/

and other combo as well but same error. and I found that tree utility is by default installed there.

I clone the git repo and put my script in local and git add-commit-push. but I'm unble to find in that machine. I mean in git/pythonapp.git/ folder. these files/folders are present in my app git repo on this openshift machine but I'm not able to find my py script.

branches config description HEAD hooks info logs objects packed-refs refs

jgillich
  • 71,459
  • 6
  • 57
  • 85
user3810188
  • 311
  • 1
  • 3
  • 14

4 Answers4

3

I also faced same problem but found the solution!!!

You can only scp to a directory specified by $OPENSHIFT_DATA_DIR, in my case it was app-root/data in home directory.

so use command like

scp Desktop/test.py <some_weird_string>@pythonapp-eric.rhcloud.com:~/app-root/data/.

and it should work.

vijay
  • 494
  • 5
  • 17
1

Change this:

scp Desktop/test.py <some_weird_string>@pythonapp-eric.rhcloud.com:/

to this:

scp Desktop/test.py <some_weird_string>@pythonapp-eric.rhcloud.com:

The difference is that there is no / at the end. The / at the end means you want to copy to the root filesystem, and it's normal that you don't have permission to do that.

In the command scp localpath user@server:remotepath the part after the : is the destination path on the server where you want to copy your file. If you put nothing (the command ends with : and nothing after), that means putting the file in your home directory on the server.

janos
  • 120,954
  • 29
  • 226
  • 236
  • I've tried that as well, but same error `Permission denied` – user3810188 Jul 12 '14 at 18:32
  • In your examples, sometimes you write `@...`, and sometimes `@...`. This part should be the same for `scp` as it is for `ssh`. Also, can you create files on the server when logged in with `ssh`? For example can you do this: `touch hello.txt` – janos Jul 12 '14 at 18:35
  • no I cannot create file :O `touch: cannot touch 'test.txt': Permission denied` – user3810188 Jul 12 '14 at 18:37
  • please see my edited question. I'm unable to find my .py file in git repo – user3810188 Jul 12 '14 at 18:38
  • I don't see what a `.py` has anything to do with your problem. Find a place on the server where you have write permission (where you do things like `touch test.txt`), and the `scp` command should work just fine. If you have other questions about pip and git, I think you should post new questions for those. – janos Jul 12 '14 at 19:08
1
rhc scp awesomeapp upload /path/to/upload/file /tmp/

coping to all the other interesting folders works but will give you interesting results. you will always have create/write access to /tmp/, you save your file there then move it around via ssh,

rhc ssh -a awesomeapp
Comfort Chauke
  • 126
  • 1
  • 9
0

I also had this problem, it could be that you need to use the hash that you find in your openshift account.

Login to your account and look at the ssh key that is used to clone your app. I found this was different to the key that I had when I was using rhc ssh.

Neil
  • 7,861
  • 4
  • 53
  • 74