Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: How to get a file from server using command prompt

  1. #1
    Join Date
    Sep 2012
    Location
    Guntur
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    How to get a file from server using command prompt

    hi guys

    how can i download a file from server using commands??

    what i want to say is i have to download a file from server which is at /home/krishna/links in the server

    the servers ip is 10.40.70.68
    my ip is 10.40.70.51

    my user id in server is mohan
    paswd is <snip>

    how can i obtain the links file using commands??
    Any Suggestions please
    Last edited by lisati; November 26th, 2012 at 09:59 AM. Reason: Hide passsword

  2. #2
    Join Date
    Jun 2011
    Location
    United Kingdom
    Beans
    Hidden!
    Distro
    Lubuntu Development Release

    Re: How to get a file from server using command prompt

    Which protocol? SSH, FTP, (HTTP)?

    EDIT: please don't post your password!

  3. #3
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: How to get a file from server using command prompt

    Yes, which protocol? If it is HTTP or anonymous FTP, then use lynx or wget. If it is SSH then use sftp or scp.

  4. #4
    Join Date
    Sep 2012
    Location
    Guntur
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How to get a file from server using command prompt

    Quote Originally Posted by Lars Noodén View Post
    Yes, which protocol? If it is HTTP or anonymous FTP, then use lynx or wget. If it is SSH then use sftp or scp.

    it's ssh how can use sftp of scp??

  5. #5
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    sftp

    Check the manual page for sftp for details, but the general usage is with the username and remote host:

    Code:
    [s]sftp -l user server.example.org/s]
    sftp user@server.example.org
    Inside sftp, put and get are your two main commands, but there are many others described in the manual page.
    Last edited by Lars Noodén; November 26th, 2012 at 09:54 AM. Reason: oops

  6. #6
    Join Date
    Sep 2012
    Location
    Guntur
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: sftp

    Quote Originally Posted by Lars Noodén View Post
    Check the manual page for sftp for details, but the general usage is with the username and remote host:

    Code:
    sftp -l user server.example.org
    Inside sftp, put and get are your two main commands, but there are many others described in the manual page.
    Pardon me but can you explain that to me by a example...

    What i have to do is download a certain file from the server and move it to my home folder..

    how can i use sftp protocol in shell script?? i even tried from my terminal but no avail.. here is what it's saying

    Code:
    krishna@ubuntu:~$ sftp -l mohan 10.40.70.68
    usage: sftp [-1246Cpqrv] [-B buffer_size] [-b batchfile] [-c cipher]
              [-D sftp_server_path] [-F ssh_config] [-i identity_file] [-l limit]
              [-o ssh_option] [-P port] [-R num_requests] [-S program]
              [-s subsystem | sftp_server] host
           sftp [user@]host[:file ...]
           sftp [user@]host[:dir[/]]
           sftp -b batchfile [user@]host
    krishna@ubuntu:~$ sftp -l mohan 10.40.70.68 /home/mohan/link
    usage: sftp [-1246Cpqrv] [-B buffer_size] [-b batchfile] [-c cipher]
              [-D sftp_server_path] [-F ssh_config] [-i identity_file] [-l limit]
              [-o ssh_option] [-P port] [-R num_requests] [-S program]
              [-s subsystem | sftp_server] host
           sftp [user@]host[:file ...]
           sftp [user@]host[:dir[/]]
           sftp -b batchfile [user@]host
    krishna@ubuntu:~$ sftp -l mohan 10.40.70.68 : /home/mohan/link
    usage: sftp [-1246Cpqrv] [-B buffer_size] [-b batchfile] [-c cipher]
              [-D sftp_server_path] [-F ssh_config] [-i identity_file] [-l limit]
              [-o ssh_option] [-P port] [-R num_requests] [-S program]
              [-s subsystem | sftp_server] host
           sftp [user@]host[:file ...]
           sftp [user@]host[:dir[/]]
           sftp -b batchfile [user@]host
    krishna@ubuntu:~$ sftp -l mohan 10.40.70.68: /home/mohan/link
    usage: sftp [-1246Cpqrv] [-B buffer_size] [-b batchfile] [-c cipher]
              [-D sftp_server_path] [-F ssh_config] [-i identity_file] [-l limit]
              [-o ssh_option] [-P port] [-R num_requests] [-S program]
              [-s subsystem | sftp_server] host
           sftp [user@]host[:file ...]
           sftp [user@]host[:dir[/]]
           sftp -b batchfile [user@]host
    krishna@ubuntu:~$ sftp -o mohan 10.40.70.68: /home/mohan/link
    command-line: line 0: Bad configuration option: mohan
    Couldn't read packet: Connection reset by peer
    krishna@ubuntu:~$ sftp -o 10.40.70.68 
    usage: sftp [-1246Cpqrv] [-B buffer_size] [-b batchfile] [-c cipher]
              [-D sftp_server_path] [-F ssh_config] [-i identity_file] [-l limit]
              [-o ssh_option] [-P port] [-R num_requests] [-S program]
              [-s subsystem | sftp_server] host
           sftp [user@]host[:file ...]
           sftp [user@]host[:dir[/]]
           sftp -b batchfile [user@]host

  7. #7
    Join Date
    Aug 2010
    Location
    Lancs, United Kingdom
    Beans
    1,588
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: sftp

    Quote Originally Posted by Mohan1289 View Post
    What i have to do is download a certain file from the server and move it to my home folder..
    It sounds like scp would be better for this than sftp.
    Code:
    scp mohan@10.40.70.68:/path/to/remote/file  ~/
    To use sftp, you could set up a batch file with cd and get commands, then do:
    Code:
    sftp -b name_of_batch_file mohan@10.40.70.68

  8. #8
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: How to get a file from server using command prompt

    Oops. I wrote the wrong line. -l does not work for sftp so it would work like this instead:

    Code:
    sftp mohan@server.example.org

  9. #9
    Join Date
    Sep 2012
    Location
    Guntur
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: How to get a file from server using command prompt

    Quote Originally Posted by Lars Noodén View Post
    Oops. I wrote the wrong line. -l does not work for sftp so it would work like this instead:

    Code:
    sftp mohan@server.example.org

    I tried like this in a normal terminal

    Code:
    sftp mohan@10.40.70.68:/home/mohan/link
    then it prompt me for the password?? can't i get the file without prompting for the password of mohan at the server?

  10. #10
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: How to get a file from server using command prompt

    To get a file without the password, you'll have to set up a web server or an Anonymous FTP server and then put the file in the directory that is published by the server. Apache is by far the most common web server, but nginx is gaining in popularity.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •