Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Ubuntu server ssh key gen + file transfer Q

  • 28-07-2013 6:12pm
    #1
    Registered Users, Registered Users 2 Posts: 7,639 ✭✭✭


    So I have spun up an ubuntu 13.04 cloud server to host my business site on and to learn a bit more about the server side of web technologies.

    It is a rackspace cloud server and the rest of my sites are hosted on rackspace cloud sites. You only have ftp access to the cloud sites.

    I have two questions.

    1. the first is I have tried to use the ftp app that comes with ubuntu server to ftp into one of my cloud sites and download the files. I want to do it this way as this particular client has uploaded gigabytes of photos and I just don't ahve the bandqidth to download and reupload that much data in a reasonable amount of time. The problem is I can't figure out how to download more than one file at a time with ubuntu ftp through the command line. I also dont know how to download everything in a directory including any directories and there contents. I installed master commander and tried that but honestly I couldnt figure out how to even connect tot he ftp server with mc.

    2. My second question has to do with ssh. I want to be able to use github and their service hooks to deploy sites and apps to the server. to do this I need to create an ssh key and put the public key into github. I go through the ssh keygen process on the b=ubuntu server and it says that the key has been generated and saved in /home/'myusername'/id_somethiing i cant remember right not. But when I open that file with nano it is an empty file. googling that problem brings up one person with a similar problem who said it was caused by there being too many processes running that it couldnt write to the file but this is a brand new server with 80gb disk 2gbram and 2 core processor and it has literally nothing else running.

    Any ideas are greatly appreciated


Comments

  • Closed Accounts Posts: 18,966 ✭✭✭✭syklops


    2. My second question has to do with ssh. I want to be able to use github and their service hooks to deploy sites and apps to the server. to do this I need to create an ssh key and put the public key into github. I go through the ssh keygen process on the b=ubuntu server and it says that the key has been generated and saved in /home/'myusername'/id_somethiing i cant remember right not. But when I open that file with nano it is an empty file. googling that problem brings up one person with a similar problem who said it was caused by there being too many processes running that it couldnt write to the file but this is a brand new server with 80gb disk 2gbram and 2 core processor and it has literally nothing else running.

    I'll answer the second one for you first.

    Depending on whether you picked RSA or DSA the public key will be named id_rsa.pub, and is usually placed in /home/myusername/.ssh. You can see whether it is in there or not by doing ls -l /home/myuser/.ssh

    Alternatively, to find the file id_rsa.pub which is somewhere in your home directory, type:

    find /home/myusername -name id_rsa.pub
    1. the first is I have tried to use the ftp app that comes with ubuntu server to ftp into one of my cloud sites and download the files. I want to do it this way as this particular client has uploaded gigabytes of photos and I just don't ahve the bandqidth to download and reupload that much data in a reasonable amount of time. The problem is I can't figure out how to download more than one file at a time with ubuntu ftp through the command line. I also dont know how to download everything in a directory including any directories and there contents. I installed master commander and tried that but honestly I couldnt figure out how to even connect tot he ftp server with mc.

    A graphical ftp client might be easier for you to manipulate photos. What OS is your computer running?


  • Registered Users, Registered Users 2 Posts: 1,931 ✭✭✭PrzemoF


    OP, try mput and disable interactive mode first using "prompt". -i switch should do the same (see man ftp)


  • Registered Users, Registered Users 2 Posts: 7,639 ✭✭✭PeakOutput


    syklops wrote: »
    I'll answer the second one for you first.

    Depending on whether you picked RSA or DSA the public key will be named id_rsa.pub, and is usually placed in /home/myusername/.ssh. You can see whether it is in there or not by doing ls -l /home/myuser/.ssh

    Alternatively, to find the file id_rsa.pub which is somewhere in your home directory, type:

    find /home/myusername -name id_rsa.pub

    thanks I had the path wrong in my op and were you mentioned was actually were I was looking. I have made sure I was not misspelling the file name while opening it with nano and it is still just a blank file. I posted the same question on askubuntu.com and someone repleid that open ssh does not generate public key pairs like am trying to do but only generates the host key. I don't really understand the difference but the tutorial I was following was for my specific goal of using github to push to the server.


    A graphical ftp client might be easier for you to manipulate photos. What OS is your computer running?

    windows 7. I read somewhere that you can use graphical programmes through the shell without actually installing a gui or window manager on your server but I am not sure if there are other steps I need to go through besides installing a graphical ftp app.
    OP, try mput (and disable interactive mode first using "prompt")

    so I know mput is an ftp client of some sort can you just explain a little what disabling interactive mode means?


  • Registered Users, Registered Users 2 Posts: 2,105 ✭✭✭ectoraige


    Did you use sudo when you ran ssh-keygen? If you did, this could be the problem, there's no need to use sudo for yourself.


  • Registered Users, Registered Users 2 Posts: 7,639 ✭✭✭PeakOutput


    ectoraige wrote: »
    Did you use sudo when you ran ssh-keygen? If you did, this could be the problem, there's no need to use sudo for yourself.

    I did use sudo but I think I tried it with and without sudo. Does it not need sudo to create the file? I havnt got my head around the permissions side of things yet so I am not sure what directories and files etc need root privileges to access etc.

    I will try again later when I get the chance with and without sudo.


  • Advertisement
  • Closed Accounts Posts: 18,966 ✭✭✭✭syklops


    in internet explorer, type ftp://<ip address of server>. It will prompt you for your username and password and you will then see a graphical representation of the files on the server. Thats what I meant about a graphical FTP client.

    Can you paste here exactly what commands you executed for creating the SSH key?


  • Registered Users, Registered Users 2 Posts: 7,639 ✭✭✭PeakOutput


    syklops wrote: »
    Can you paste here exactly what commands you executed for creating the SSH key?

    yeah I can thanks but it wont be until later on today or tonight.
    in internet explorer, type ftp://<ip address of server>. It will prompt you for your username and password and you will then see a graphical representation of the files on the server. Thats what I meant about a graphical FTP client.

    ok but that will only help me download it to my desktop? I am trying to ftp to my server from another server that I only have ftp access to.


  • Registered Users, Registered Users 2 Posts: 2,105 ✭✭✭ectoraige


    PeakOutput wrote: »
    I did use sudo but I think I tried it with and without sudo. Does it not need sudo to create the file? I havnt got my head around the permissions side of things yet so I am not sure what directories and files etc need root privileges to access etc.

    sudo elevates the privileges of the command being run so that it has "Super User" privileges. These privileges are needed to modify files owned by other users, including system users, typically these would be system configuration files.

    You do not require any additional privileges to use your own files, i.e. anything in your home directory. When you are generating your keys, these are individual to you, so they are stored in your home directoy.

    In general, if you don't know if a command requires sudo or not, then try it without - it you were wrong, then you'll just get some kind of "Permission denied" message, and you can try again. If on the other hand you use it when you shouldn't, you could end up screwing something up.
    I will try again later when I get the chance with and without sudo.

    Before you do, make sure that you still have the correct permissions for your .ssh directory:

    % ls -al ~/.ssh

    This will list all the files in the directory, including the directory itself - ".".
    Make sure the owner of all the files is yourself.

    If this isn't helping, perhaps link to the instructions you are following, and post the output of the "ls" command above.


  • Registered Users, Registered Users 2 Posts: 2,105 ✭✭✭ectoraige


    PeakOutput wrote: »
    yeah I can thanks but it wont be until later on today or tonight.



    ok but that will only help me download it to my desktop? I am trying to ftp to my server from another server that I only have ftp access to.

    Your right, that would download to your desktop. I think the command you don't know about is 'mget'.

    To pull onto the target server from the remote server with ftp would be something like:

    ssh target_server
    cd target_directory
    ftp ftp.source.example
    cd source_directory
    mget *

    If it's the other way around, that you want to push the files from the source to the target would be something like:
    ssh source_server
    cd source_directory
    ftp ftp.target.example
    cd target_directory
    mput *

    Hope this helps.


  • Registered Users, Registered Users 2 Posts: 7,639 ✭✭✭PeakOutput


    thanks for all the replies, I am under the gun at work right now so won't get back to this particular problem for a day or two but I will keep you updated.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,028 ✭✭✭d31b0y


    You can also use wget to mirror all files stored in an FTP location:
    wget -m ftp://username:password@ftp.host.address/sub/dir/


  • Registered Users, Registered Users 2 Posts: 53 ✭✭spynappels


    +1 for using mget, you can use wildcards as well to limit the results, so:

    mget *.jpg will fetch all jpegs
    mget DSC1*.jpg will fetch all jpegs whose filenames start with DSC1 etc.

    Also important when fetching files like tarballs (*.tar.gz, *.tgz) is to use binary rather than ASCII, to avoid possible corruption of the tarball. This especially matters on Solaris, not sure if any of the servers you access will have Solaris running.

    ftp ftp.source.example
    bin
    mget .....


  • Registered Users, Registered Users 2 Posts: 7,639 ✭✭✭PeakOutput


    thanks for all the suggestions

    lftp's mirror command worked wonders

    mirror -r worked great for putting the files onto the new server as well


Advertisement