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

    Solved OpenSSH installed, but cannot use SCP

    IT Discussion
    linux centos 6.7 ssh scp openssh centos rhel rhel 6 centos 6
    7
    44
    7.8k
    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.
    • KellyK
      Kelly
      last edited by scottalanmiller

      So I'm working up a template for my new XS install, and I need to copy a file over to it. I can ssh to it without any problem. Unfortunately when I attempt to scp the file over it prompts for authentication and then says "command not found". On the remote box I checked and the newest version of OpenSSH-Server is installed.

      Any thoughts?

      P.S. At this point I'm less interested in work arounds because I want to learn to work with scp by solving this issue, not simply get the file to the remote server (although that is a goal).

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

        Okay, SCP definitely exists on CentOS 6.7 so....

        Let's start with figuring out what the default shell is.

        What is the output of...

        grep USERNAME /etc/passwd
        

        Where USERNAME is the username of the account that you are using for the SCP connection. This is on the server side.

        KellyK 1 Reply Last reply Reply Quote 0
        • KellyK
          Kelly @scottalanmiller
          last edited by

          @scottalanmiller said:

          Okay, SCP definitely exists on CentOS 6.7 so....

          Let's start with figuring out what the default shell is.

          What is the output of...

          grep USERNAME /etc/passwd
          

          Where USERNAME is the username of the account that you are using for the SCP connection. This is on the server side.

          operator❌11:0:operator:/<username>:/sbin/nologin

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

            @Kelly said:

            operator❌11:0:operator:/<username>:/sbin/nologin

            That's the issue. No shell from which to run SCP.

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

              SCP is part of SSH. To use it the account needs to login. Same as SFTP. You can't restrict an SSH account in this way. Nogin blocks SSH completely.

              KellyK 1 Reply Last reply Reply Quote 0
              • KellyK
                Kelly @scottalanmiller
                last edited by

                @scottalanmiller said:

                SCP is part of SSH. To use it the account needs to login. Same as SFTP. You can't restrict an SSH account in this way. Nogin blocks SSH completely.

                So what do I need to do to fix it?

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

                  Where you have /sbin/nologin you need to have /bin/bash instead.

                  KellyK 1 Reply Last reply Reply Quote 2
                  • KellyK
                    Kelly @scottalanmiller
                    last edited by

                    @scottalanmiller said:

                    Where you have /sbin/nologin you need to have /bin/bash instead.

                    Ok, I edited /etc/passwd to change /sbin/nologin to /bin/bash. No change. When I'm logged in as root and just type scp I'm still getting command not found.

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

                      Okay, now THAT is weird. The weirdest part was that I was able to predict that you had nologin in the /etc/passwd file and that turned out to be true, but not the issue!!!

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

                        With root, what does this return:

                        which scp
                        
                        KellyK 1 Reply Last reply Reply Quote 1
                        • scottalanmillerS
                          scottalanmiller
                          last edited by

                          Wait, you checked on OpenSSH... client or server? What OpenSSH packages do you actually have there. List them all...

                          rpm -qa | grep ssh
                          
                          1 Reply Last reply Reply Quote 0
                          • KellyK
                            Kelly @scottalanmiller
                            last edited by

                            @scottalanmiller said:

                            With root, what does this return:

                            which scp
                            

                            /usr/bin/which: no scp in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

                            (how do you use code blocks?)

                            openssh-5.3p1-112.el6_7.x86_64
                            openssh-server-5.3p1-112.el6_7.x86_64
                            libssh2-1.4.2-1.el6_6.1.x86_64

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

                              Code blocks is just for spaces at the beginning of a line.

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

                                Okay, OpenSSH is missing files.

                                yum reinstall openssh
                                
                                1 Reply Last reply Reply Quote 2
                                • KellyK
                                  Kelly
                                  last edited by

                                  No joy. I'm still getting the same output when I run just scp or which scp.

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

                                    What is the history on this remote server? What was installed, what modified since it was put in?

                                    KellyK 1 Reply Last reply Reply Quote 0
                                    • JaredBuschJ
                                      JaredBusch @scottalanmiller
                                      last edited by

                                      @scottalanmiller said:

                                      Code blocks is just for spaces at the beginning of a line.

                                      That is a shortcut for single line.

                                      A full block is three backticks on a line by itself, then the code, then three backticks on a line by itself to close it.

                                      scottalanmillerS KellyK 2 Replies Last reply Reply Quote 3
                                      • scottalanmillerS
                                        scottalanmiller @JaredBusch
                                        last edited by

                                        @JaredBusch said:

                                        @scottalanmiller said:

                                        Code blocks is just for spaces at the beginning of a line.

                                        That is a shortcut for single line.

                                        A full block is three backticks on a line by itself, then the code, then three backticks on a line by itself to close it.

                                        That's way handier than what I have been doing. I need to start doing that.

                                        1 Reply Last reply Reply Quote 2
                                        • stacksofplatesS
                                          stacksofplates @Kelly
                                          last edited by

                                          @Kelly said:

                                          No joy. I'm still getting the same output when I run just scp or which scp.

                                          On both servers or just one?

                                          KellyK 1 Reply Last reply Reply Quote 0
                                          • KellyK
                                            Kelly @scottalanmiller
                                            last edited by

                                            @scottalanmiller said:

                                            What is the history on this remote server? What was installed, what modified since it was put in?

                                            Brand new, clean install. The only thing I've done on it is run updates.

                                            scottalanmillerS 1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 1 / 3
                                            • First post
                                              Last post