ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Linux SCP issue

    IT Discussion
    linux scp ssh
    3
    21
    3.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller @bbigford
      last edited by

      @BBigford said:
      I'm told going the RSA route isn't possible at this time or we'd try that.

      You mean the keyed route? Find out why and fix that first. Don't let someone just wave off security like it isn't important enough to discuss. Push back hard.

      bbigfordB 1 Reply Last reply Reply Quote 0
      • scottalanmillerS
        scottalanmiller @stacksofplates
        last edited by

        @johnhooks said:

        As far as I know (I could be wrong) to scp to / you need to be root or sudo the scp

        Nope, nothing like that. SCP is just a protocol on SSH. If you can log in, you can SCP.

        stacksofplatesS 1 Reply Last reply Reply Quote 0
        • scottalanmillerS
          scottalanmiller @stacksofplates
          last edited by

          @johnhooks said:

          It's also not a good idea to have the password in the script. It should be kept in a file with 400 permissions for the user, or ideally use a key.

          It should only ever be a key.

          1 Reply Last reply Reply Quote 0
          • stacksofplatesS
            stacksofplates @scottalanmiller
            last edited by

            @scottalanmiller said:

            @johnhooks said:

            As far as I know (I could be wrong) to scp to / you need to be root or sudo the scp

            Nope, nothing like that. SCP is just a protocol on SSH. If you can log in, you can SCP.

            Don't you need to have sudo permissions or be root to copy to the root folder though?

            scottalanmillerS 1 Reply Last reply Reply Quote 1
            • scottalanmillerS
              scottalanmiller @stacksofplates
              last edited by

              @johnhooks said:

              Don't you need to have sudo permissions or be root to copy to the root folder though?

              Ah, not necessarily. But 99% of the time, yes.

              1 Reply Last reply Reply Quote 2
              • scottalanmillerS
                scottalanmiller @bbigford
                last edited by

                for i in find /home/msftp/cdr -type f -ctime -1

                Backticks are a bad practice from like a decade ago. It should be written this way:

                for i in $(find /home/msftp/cdr -type f -ctime -1)
                
                1 Reply Last reply Reply Quote 0
                • scottalanmillerS
                  scottalanmiller
                  last edited by

                  Run this command manually, does it fail?

                  scp $i usyrnet@222.55.888.9:/
                  
                  1 Reply Last reply Reply Quote 0
                  • scottalanmillerS
                    scottalanmiller
                    last edited by

                    What error are you getting? You asked us if there was a problem but did not state what issue you were having.

                    bbigfordB 1 Reply Last reply Reply Quote 0
                    • bbigfordB
                      bbigford @scottalanmiller
                      last edited by

                      @scottalanmiller The remote server is administered by a different company. I was told just a few minutes ago that they haven't asked... Told them to use rsync but haven't heard back yet.

                      scottalanmillerS 3 Replies Last reply Reply Quote 0
                      • scottalanmillerS
                        scottalanmiller
                        last edited by

                        What is the output of this command?

                        find /home/msftp/cdr -type f -ctime -1
                        
                        1 Reply Last reply Reply Quote 0
                        • scottalanmillerS
                          scottalanmiller @bbigford
                          last edited by

                          @BBigford said:

                          @scottalanmiller The remote server is administered by a different company. I was told just a few minutes ago that they haven't asked...

                          Should not need to ask. If you have the right to log in as that user, you set up the key yourself. The other company likely has no control there. That would be unlikely.

                          1 Reply Last reply Reply Quote 0
                          • scottalanmillerS
                            scottalanmiller @bbigford
                            last edited by

                            @BBigford said:

                            @scottalanmiller The remote server is administered by a different company.

                            So the chances that you have access to write to / are nearly zero, then. That's probably your issue.

                            1 Reply Last reply Reply Quote 0
                            • bbigfordB
                              bbigford @scottalanmiller
                              last edited by

                              @scottalanmiller the admin says that the script will run, but simply doesn't copy. There's no error thrown (sorry that isn't more helpful). If he would get back to me already, I'd have him run those commands right now.

                              1 Reply Last reply Reply Quote 0
                              • scottalanmillerS
                                scottalanmiller @bbigford
                                last edited by

                                @BBigford said:

                                Told them to use rsync but haven't heard back yet.

                                Rsync is a good tool to use, of course, but unlikely to matter here.

                                1 Reply Last reply Reply Quote 0
                                • bbigfordB
                                  bbigford
                                  last edited by bbigford

                                  Got it figured out. Turns out that the directory being called, didn't exist. All good now though, thanks for all the quick responses!

                                  scottalanmillerS 1 Reply Last reply Reply Quote 2
                                  • scottalanmillerS
                                    scottalanmiller @bbigford
                                    last edited by

                                    @BBigford said:

                                    Got it figured out. Turns out that the directory being called, didn't exist. All good now though, thanks for all the quick responses!

                                    It did exist, it's the filesystem root. The issue was that the user did not have permissions there 🙂 I'm sure this was caused by accidentally forgetting the correct directory when making the script, but there is a director specified, it's just not one you would want to use 🙂

                                    1 Reply Last reply Reply Quote 0
                                    • stacksofplatesS
                                      stacksofplates
                                      last edited by stacksofplates

                                      Had to finish some stuff at work and eat dinner with the wife and kiddo, but I was thinking about it. Once they set up a key you can do this with one line (if you don't use a key you would need the password for each file).

                                      find /home/msftp/cdr -type f -ctime -1 -exec scp {} usyrnet@222.55.888.9:/whatever/folder \;
                                      
                                      1 Reply Last reply Reply Quote 1
                                      • scottalanmillerS
                                        scottalanmiller
                                        last edited by

                                        Yeah, you can get that to be pretty simple with a little work (and keys.)

                                        1 Reply Last reply Reply Quote 1
                                        • 1
                                        • 2
                                        • 1 / 2
                                        • First post
                                          Last post