LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   SSHing into an iPod, how do I display/open files and how do I move them to filesystem (https://www.linuxquestions.org/questions/linux-newbie-8/sshing-into-an-ipod-how-do-i-display-open-files-and-how-do-i-move-them-to-filesystem-883817/)

theif519 05-31-2011 05:37 PM

SSHing into an iPod, how do I display/open files and how do I move them to filesystem
 
Well, figuring out that just plugging in my iPod in Ubuntu only shows certain files, music, and images, the other important and "Juicy" stuff that I've saved on iFile is there, like PDFs and documents and whatnot. Should I just take the easy way out and move everything from my iPod to a file that can be easily read *Yet hard to locate on my iPod* so I can just transfer it from there, or should I do it the hard way and try to find out how? Well, I've always wanted to learn how to move files over a Secure Shell, so I guess now would be the best time to learn. What commands do I have to use to move files from one machine/device to another? Should I copy the files first before attempting to move them? Are there any switching accompanying the commands and can you explain what they do so I know what and why I'll be using them so I can consider them in future use. Also, in order to SSH into it, I had to do it as root
Code:

sudo -i
Anyway, another thing, if you could be so kind, this is optional, could you tell me more about how SSH works? You don't need to though, I only need an answer for SSH commands.

evo2 05-31-2011 08:34 PM

To ssh to a device, that device needs to be running and ssh server/daemon. I've never used and ipod, but I would be amazed if they run an ssh daemon: have you read/heard something that indicates that they do?

Anyway, you can't really "move" files, but you can "copy" them (but I guess by deleting the local file after copying it you have effectively moved it). scp is the classic command for copying files over ssh, but you can also use things like rsync: eg "rsync -e ssh". Other fun things you can do include mounting a remote file system with fuse/sshfs.

Evo2.

MrCode 05-31-2011 08:53 PM

Quote:

I would be amazed if they run an ssh daemon
Actually, you can install an OpenSSH server on an iPhone/iPod Touch, but it involves "jailbreaking" the device (i.e. allowing installation of apps outside Apple's App Store).

theif519 05-31-2011 09:01 PM

Quote:

Originally Posted by MrCode (Post 4372535)
Actually, you can install an OpenSSH server on an iPhone/iPod Touch, but it involves "jailbreaking" the device (i.e. allowing installation of apps outside Apple's App Store).

Which is what I did, I jailbroke it a while ago.

theif519 05-31-2011 09:07 PM

Quote:

Originally Posted by evo2 (Post 4372523)
To ssh to a device, that device needs to be running and ssh server/daemon. I've never used and ipod, but I would be amazed if they run an ssh daemon: have you read/heard something that indicates that they do?

Anyway, you can't really "move" files, but you can "copy" them (but I guess by deleting the local file after copying it you have effectively moved it). scp is the classic command for copying files over ssh, but you can also use things like rsync: eg "rsync -e ssh". Other fun things you can do include mounting a remote file system with fuse/sshfs.

Evo2.

Code:

theif519@theif519-Inspiron-580s:~$ sudo -i
[sudo] password for theif519:
root@theif519-Inspiron-580s:~# ssh 192.168.1.2
root@192.168.1.2's password:
theif519s-iPod:~ root# ls
Documents/  Library/  Media/  NinjaGa.nes  Ninja_Gaiden_1.zip
theif519s-iPod:~ root# cd /
theif519s-iPod:/ root# ls
Applications@  Library/  Thumbs.db  bin/  cores/  etc@  mnt/      sbin/  usr/
Developer/    System/  User@      boot/  dev/    lib/  private/  tmp@  var@
theif519s-iPod:/ root# cd var
theif519s-iPod:/var root# ls
Keychains/            cache/    include/  log/          root/  vm/
Managed\ Preferences/  db/      keybags/  logs/        run/    wireless/
MobileDevice/          ea/      lib/      mobile/      spool/
audit/                empty/    local/    msgs/        stash/
backups/              folders/  lock/    preferences/  tmp/
theif519s-iPod:/var root# cd ..
theif519s-iPod:/ root# ls
Applications@  Library/  Thumbs.db  bin/  cores/  etc@  mnt/      sbin/  usr/
Developer/    System/  User@      boot/  dev/    lib/  private/  tmp@  var@
theif519s-iPod:/ root# cd User
theif519s-iPod:/User root# ls
Applications/  Documents/  Library/  Media/  loader_package.tar
theif519s-iPod:/User root# cd Documents
theif519s-iPod:/User/Documents root# cd
theif519s-iPod:~ root# ls
Documents/  Library/  Media/  NinjaGa.nes  Ninja_Gaiden_1.zip
theif519s-iPod:~ root# cd Documents
theif519s-iPod:~/Documents root# ls
admob/
theif519s-iPod:~/Documents root# cd ..
theif519s-iPod:~ root# cd ..
theif519s-iPod:/var root# cd /
theif519s-iPod:/ root# ls
Applications@  Library/  Thumbs.db  bin/  cores/  etc@  mnt/      sbin/  usr/
Developer/    System/  User@      boot/  dev/    lib/  private/  tmp@  var@
theif519s-iPod:/ root# cd User
theif519s-iPod:/User root# ls
Applications/  Documents/  Library/  Media/  loader_package.tar
theif519s-iPod:/User root# cd Documents
theif519s-iPod:/User/Documents root# ls
Intro_To_Linux.pdf  Linux_Command-Line.pdf  Rute_Users_Guide.pdf  admob/
KLPhotoMosaic/      Linux_Shell.pdf        Slackware_Guide.pdf  mobclix.db
theif519s-iPod:/User/Documents root# rsync -e ssh
-sh: rsync: command not found
theif519s-iPod:/User/Documents root#

rsync wasn't recognized... do I have to do it in my own terminal or in the SSH'd iPod Terminal? Is there a front-end for SSHing that's on Linux?

evo2 05-31-2011 09:31 PM

There are many ssh client front ends. I personally prefer just using ssh from the command line. However as I understand it many file managers have ssh built in so you can "drag-n-drop" files in the same way you would normally use a file manager.

One thing I thought I should mention is that you should not need to be root on you pc to ssh to your ipod, you just need to specify that the user on the ipod is root:

Eg
Code:

theif519@theif519-Inspiron-580s:~$ ssh root@192.168.1.2
It seems that rsync is not installed on your ipod. Also if it was you would use it something like:

Code:

theif519@theif519-Inspiron-580s:~$ rsync -e ssh  /home/theif519/Music root@192.168.1.2:/User/Media
Evo2.

evo2 05-31-2011 09:52 PM

Ok, just realized that what you want to do is copy files from your ipod onto your computer. If for example you wanted to copy all the files in /User/Documents you could do the following

Code:

theif519@theif519-Inspiron-580s:~$ scp -r root@192.1681.2.:/User/Documents .
Evo2.

theif519 06-01-2011 03:50 PM

Quote:

Originally Posted by evo2 (Post 4372567)
Ok, just realized that what you want to do is copy files from your ipod onto your computer. If for example you wanted to copy all the files in /User/Documents you could do the following

Code:

theif519@theif519-Inspiron-580s:~$ scp -r root@192.1681.2.:/User/Documents .
Evo2.

Code:

theif519@theif519-Inspiron-580s:~$ ssh root@192.168.1.2
ssh: connect to host 192.168.1.2 port 22: No route to host
theif519@theif519-Inspiron-580s:~$ ssh root@192.168.1.2
root@192.168.1.2's password:
theif519s-iPod:~ root# scp -r root@192.1681.2.:/User/Documents
usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
          [-l limit] [-o ssh_option] [-P port] [-S program]
          [[user@]host1:]file1 ... [[user@]host2:]file2
theif519s-iPod:~ root# cd /User/Documents
theif519s-iPod:/User/Documents root# scp -r root@192.1681.2.:/User/Documents .
ssh: Could not resolve hostname 192.1681.2.: nodename nor servname provided, or not known
theif519s-iPod:/User/Documents root# scp -r root@192.1681.2.:/User/Documents .

It didn't work...

evo2 06-01-2011 03:55 PM

You are running the command from the wrong machine.

Evo2.

theif519 06-01-2011 04:04 PM

Quote:

Originally Posted by evo2 (Post 4373457)
You are running the command from the wrong machine.

Evo2.

Code:

theif519@theif519-Inspiron-580s:~$ theif519@theif519-Inspiron-580s:~$ ssh root@192.168.1.2
theif519@theif519-Inspiron-580s:~$: command not found
theif519@theif519-Inspiron-580s:~$ ssh: connect to host 192.168.1.2 port 22: No route to host
No command 'ssh:' found, did you mean:
 Command 'sshd' from package 'openssh-server' (main)
 Command 'ssh' from package 'openssh-client' (main)
 Command 'sshm' from package 'sshm' (universe)
ssh:: command not found
theif519@theif519-Inspiron-580s:~$ theif519@theif519-Inspiron-580s:~$ ssh root@192.168.1.2
theif519@theif519-Inspiron-580s:~$: command not found
theif519@theif519-Inspiron-580s:~$ root@192.168.1.2's password:
> theif519s-iPod:~ root# scp -r root@192.1681.2.:/User/Documents
> usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
>            [-l limit] [-o ssh_option] [-P port] [-S program]
>            [[user@]host1:]file1 ... [[user@]host2:]file2
> theif519s-iPod:~ root# cd /User/Documents
> theif519s-iPod:/User/Documents root# scp -r root@192.1681.2.:/User/Documents .
> ssh: Could not resolve hostname 192.1681.2.: nodename nor servname provided, or not known
> theif519s-iPod:/User/Documents root# scp -r root@192.1681.2.:/User/Documents .
> root@192.168.1.2's password:
theif519s-iPod:~ root# scp -r root@192.1681.2.:/User/Documents
usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
          [-l limit] [-o ssh_option] [-P port] [-S program]
          [[user@]host1:]file1 ... [[user@]host2:]file2
theif519s-iPod:~ root# cd /User/Documents
theif519s-iPod:/User/Documents root# scp -r root@192.1681.2.:/User/Documents .
ssh: Could not resolve hostname 192.1681.2.: nodename nor servname provided, or not known
theif519s-iPod:/User/Documents root# scp -r root@192.1681.2.:/User/Documents /home/theif519/Documents
bash: root@192.168.1.2s password:
theif519s-iPod:~ root# scp -r root@192.1681.2.:/User/Documents
usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
          [-l limit] [-o ssh_option] [-P port] [-S program]
          [[user@]host1:]file1 ... [[user@]host2:]file2
theif519s-iPod:~ root# cd /User/Documents
theif519s-iPod:/User/Documents root# scp -r root@192.1681.2.:/User/Documents .
ssh: Could not resolve hostname 192.1681.2.: nodename nor servname provided, or not known
theif519s-iPod:/User/Documents root# scp -r root@192.1681.2.:/User/Documents .
root@192.168.1.2s: No such file or directory
theif519s-iPod:~: command not found
usage:: command not found
[-l: command not found
[[user@]host1:]file1: command not found
theif519s-iPod:~: command not found
bash: theif519s-iPod:/User/Documents: No such file or directory
No command 'ssh:' found, did you mean:
 Command 'sshd' from package 'openssh-server' (main)
 Command 'ssh' from package 'openssh-client' (main)
 Command 'sshm' from package 'sshm' (universe)
ssh:: command not found
bash: theif519s-iPod:/User/Documents: No such file or directory
theif519@theif519-Inspiron-580s:~$ theif519s-iPod:/User/Documents root# scp -r root@192.1681.2.:/User/Documents /Home/theif519/Documents
bash: theif519s-iPod:/User/Documents: No such file or directory
theif519@theif519-Inspiron-580s:~$ theif519s-iPod:/User/Documents root# scp -r root@192.1681.2.:/User/Documents /home/theif519/Documents
bash: theif519s-iPod:/User/Documents: No such file or directory
theif519@theif519-Inspiron-580s:~$ scp -r theif519s-iPod:/User/Documents theif519@192.168.1.4:/home/theif519/Documents
theif519@theif519-Inspiron-580s:~$ $ scp -r root@192.168.1.4:/User/Documents theif519@192.168.1.4:/home/theif519/Documents
throot@192.168.1.4's password:
Permission denied, please try again.
throot@192.168.1.4's password:
theif519@theif519-Inspiron-580s:~$ scp -r root@192.168.1.4:/User/Documents theif519@192.168.1.4:/home/theif519/Documents
root@192.168.1.4's password:
Permission denied, please try again.
root@192.168.1.4's password:
theif519@theif519-Inspiron-580s:~$ scp -r root@192.168.1.2:/User/Documents theif519@192.168.1.4:/home/theif519/Documents
root@192.168.1.2's password:
Host key verification failed.
lost connection
theif519@theif519-Inspiron-580s:~$

Sorry if I'm being a bit annoying.

evo2 06-01-2011 04:25 PM

You are still trying to run the scp on the ipod. Look at what the prompt is in the command that I posted.

Evo2.

theif519 06-01-2011 04:35 PM

Quote:

Originally Posted by evo2 (Post 4373497)
You are still trying to run the scp on the ipod. Look at what the prompt is in the command that I posted.

Evo2.

I did it! Thank you so much! But I've a question, where was it copied to?

theif519 06-01-2011 04:37 PM

Nevermind, found it in my documents section, but how did it know to send it? My present direction was /home/theif519 not /home/theif519/Documents does it automatically allocate it to a certain directory that it thinks it's supposed to go to? Also, what does the "." mean at the end of the command?

evo2 06-01-2011 04:41 PM

The "." at the end is the destination for the files. So, they should have ended up in the directory you were in when you ran the command. Please try it again to confirm this.

Evo2.

theif519 06-01-2011 04:45 PM

OH! I see what it did, it must have detected a file with the same name and instead of overwriting it, copied the subdirectories into it! Awesome! Also, I want to know how I do it the other way around? Do I do it from inside the iPod's side of the SSH Terminal or from my own?


All times are GMT -5. The time now is 06:20 PM.