3

I have a file on a remote server that I want to transfer to my android device over ssh, only using the android device in the process.

Using this setup, I tried an scp from the android device

scp remote_user@remote_host:file file

After being prompted for the password I got permission denied.

I then tried to transfer it from the remote server

scp -P 2222 file root@SSHDroid-ip:/mnt/extSdCard/file

Without being prompted for the password I now get the message that the network (of the android device) is unreachable: lost connection.

Is this a permission problem? I have transferred files over ssh from the remote server before, so I suppose the problem is on the side of the android device.

Edit.

I can transfer the file, from the remote server to the android device via scp, to the home path of the SSHDroid server on the android device. This home path is very cumbersome and deep, and can not be reached with the regular android API of the device.

So I can transfer it to the home path of the SSHDroid server, but not to the path of my SD card on the android device. Where can I change/check the permission settings of the android device?

3
  • Are you sure remote_user has premission to file on the remote_host ? Similarly are you running an ssh server in your android on port 2222 ?
    – beginer
    Commented Jul 17, 2014 at 3:48
  • I can edit the file on remote_user, so I suppose I have permission to access it. remote_host is the university server. I am indeed running an ssh server (SSHDroid) on my android device which defaults to port 2222. Since I can connect to it using vSSH, the port number should not be the issue. Commented Jul 17, 2014 at 3:58
  • Time to debug. You can verbose your scp and check. Man page shows you can use -vvv for maximum verbose.
    – beginer
    Commented Jul 17, 2014 at 4:16

1 Answer 1

2

Physically go to the remote_host and change the file owner to remote_user.

sudo chown remote_user /path/to/file

Then you should have permissions to copy the file.

7
  • Login into the remote computer with ssh. If you do not have permission to read the file while logged in with ssh, then you will not be able to copy it with scp.
    – Rucent88
    Commented Jul 17, 2014 at 4:18
  • Then I think you should check that you have permission to create files in the local directory (android side). Also, double check that the file names and directory locations are exactly correct, both locally and remotely.
    – Rucent88
    Commented Jul 17, 2014 at 4:25
  • How do I check that I have permission to create files in the local directory on the android side? Commented Jul 17, 2014 at 4:34
  • I verified that I had no permission creating a file on the SD card by trying to save a text file with vi. How can I change/get root privileges on the android device, that is, at the location of the SD card? Sudo and su does not seem to be present on the android ssh server. Commented Jul 17, 2014 at 5:06
  • @MusséRedi I answered the question you posted about scp. Now you're asking a new question about how to edit permissions on android. I do not know the answer to your new question. You will need to make a new Question post. Android StackExchange can probably help you. :)
    – Rucent88
    Commented Jul 17, 2014 at 22:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .