Winscp ошибка 127

You will get the error with SCP protocol, if command necessary for facilitate operation you were trying to do does not exist on remote server or the shell cannot find it.

If you are not an experienced Unix user, you should first try using SFTP protocol instead.

If you are sure that the command exists on the remote server, make sure that WinSCP (or rather the shell) can find it. You may need to add path to the command to PATH environment variable. Also make sure that the startup script that sets PATH is actually executed for non-interactive sessions.

Advertisement

You can also try to run the respective command from terminal (with the same account that you use with WinSCP), to verify that you can execute it. You may not have sufficient permissions, or the command dependencies may not be installed.

Common situations, in which you may get the error:

  • Transferring files fails, because path to scp command is not in PATH;
  • Error appears while logging in, because your *nix distribution lacks groups command. You can instruct WinSCP not to use the command in site settings.

My Server is Ubuntu 14.04.5 LTS and I am able to connect SSH in Putty, but not able to connect via WinSCP.

When I try to connect via WinSCP it gives below error:

Connection has been unexpectedly closed. server sent command exit status 127

enter image description here

asked Jan 22, 2019 at 7:41

Subhash's user avatar

SubhashSubhash

7659 silver badges25 bronze badges

1

To access your sftp from other hosts, please make sure following is installed and configured properly.

  • Installed OpenSSH servers
  • Configured sshd_config
    • PubkeyAuthentication yes
    • Subsystem sftp internal-sftp
  • Added your public key to ~/.ssh/authorized_keys

  • Start the ssh server with port 22/TCP open
    # /etc/init.d/sshd start

  • # iptables -I INPUT -j ACCEPT -p tcp --dport 22

Finally, test
$ sftp <login>@<hostname>

answered Jan 24, 2019 at 13:00

Jay's user avatar

JayJay

2031 silver badge8 bronze badges

Unfortunately I can not connect via sftp to my VPS:

This is my sshd_config:

# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin no
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile  %h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding no
X11DisplayOffset 10
PrintMotd yes
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
UseDNS yes

#MaxStartups 10:30:60
Banner no

# Allow setting environment variables
AcceptEnv LANG LC_*

#Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes

AllowUsers user@xx.xxx.xx.xxx user@xx.xxx.xx.xxx apt-dater@xx.xxx.xx.xxx

Match User user
    PasswordAuthentication yes

The verbose output of my connection-attempt:

me:~ user$ sftp -v user@example.org
OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to example.org [xx.xxx.xx.xx] port 22.
debug1: Connection established.
debug1: identity file /Users/user/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/user/.ssh/id_rsa-cert type -1
debug1: identity file /Users/user/.ssh/id_dsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/user/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/user/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/user/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/user/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/user/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to example.org:22 as 'user'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client chacha20-poly1305@openssh.com <implicit> none
debug1: kex: client->server chacha20-poly1305@openssh.com <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:/RUeBQCA1w0nHUWT2OgLDhy7/bNQy4nWH2IVZatMLw4
debug1: Host 'example.org' is known and matches the RSA host key.
debug1: Found key in /Users/user/.ssh/known_hosts:4
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/user/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to example.org ([xx.xxx.xx.xx]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = de_DE.UTF-8
debug1: Sending subsystem: sftp
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Transferred: sent 3332, received 2796 bytes, in 0.2 seconds
Bytes per second: sent 18890.9, received 15852.0
debug1: Exit status 127
Connection closed

Any idea how to solve this problem?

Моим Сервером является Ubuntu 14.04.5 LTS, и я могу соединиться через SSH с PuTTY, но я не могу соединиться через WinSCP.

Когда я пытаюсь соединиться через WinSCP, он дает ошибку:

Соединение было неожиданно закрыто. сервер отправил статус выхода команды 127

Connection has been unexpectedly closed

Ниже файл журнала

. 2019-01-23 15:40:22.694 --------------------------------------------------------------------------
. 2019-01-23 15:40:22.694 WinSCP Version 5.13.7 (Build 9125) (OS 6.1.7601 Service Pack 1 - Windows 7 Professional)
. 2019-01-23 15:40:22.694 Configuration: HKCUSoftwareMartin PrikrylWinSCP 2
. 2019-01-23 15:40:22.695 Log level: Normal
. 2019-01-23 15:40:22.695 Local account: D146Subhash
. 2019-01-23 15:40:22.695 Working directory: C:Program Files (x86)WinSCP
. 2019-01-23 15:40:22.695 Process ID: 6672
. 2019-01-23 15:40:22.696 Command-line: "C:Program Files (x86)WinSCPWinSCP.exe" 
. 2019-01-23 15:40:22.696 Time zone: Current: GMT+5:30 (India Standard Time), No DST
. 2019-01-23 15:40:22.696 Login time: 23 January 2019 PM 3:40:22
. 2019-01-23 15:40:22.696 --------------------------------------------------------------------------
. 2019-01-23 15:40:22.696 Session name: winscp testing (Site)
. 2019-01-23 15:40:22.696 Host name: 71.6.186.24 (Port: 22)
. 2019-01-23 15:40:22.697 User name: root (Password: Yes, Key file: No, Passphrase: No)
. 2019-01-23 15:40:22.697 Tunnel: No
. 2019-01-23 15:40:22.697 Transfer Protocol: SFTP
. 2019-01-23 15:40:22.697 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2019-01-23 15:40:22.697 Disable Nagle: No
. 2019-01-23 15:40:22.697 Proxy: None
. 2019-01-23 15:40:22.697 Send buffer: 262144
. 2019-01-23 15:40:22.697 SSH protocol version: 2; Compression: No
. 2019-01-23 15:40:22.697 Bypass authentication: No
. 2019-01-23 15:40:22.697 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: Yes
. 2019-01-23 15:40:22.697 GSSAPI: Forwarding: No; Libs: gssapi32,sspi,custom; Custom: 
. 2019-01-23 15:40:22.697 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2019-01-23 15:40:22.697 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2019-01-23 15:40:22.697 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2019-01-23 15:40:22.697 Simple channel: Yes
. 2019-01-23 15:40:22.697 Return code variable: Autodetect; Lookup user groups: Auto
. 2019-01-23 15:40:22.697 Shell: default
. 2019-01-23 15:40:22.697 EOL: LF, UTF: Auto
. 2019-01-23 15:40:22.697 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2019-01-23 15:40:22.697 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2019-01-23 15:40:22.697 SFTP Bugs: Auto,Auto
. 2019-01-23 15:40:22.697 SFTP Server: default
. 2019-01-23 15:40:22.698 Local directory: C:UsersSubhashDocuments, Remote directory: /, Update: Yes, Cache: Yes
. 2019-01-23 15:40:22.698 Cache directory changes: Yes, Permanent: Yes
. 2019-01-23 15:40:22.698 Recycle bin: Delete to: No, Overwritten to: No, Bin path: 
. 2019-01-23 15:40:22.698 DST mode: Unix
. 2019-01-23 15:40:22.698 --------------------------------------------------------------------------
. 2019-01-23 15:40:22.722 Looking up host "71.6.186.24" for SSH connection
. 2019-01-23 15:40:22.722 Connecting to 71.6.186.24 port 22
. 2019-01-23 15:40:22.977 We claim version: SSH-2.0-WinSCP_release_5.13.7
. 2019-01-23 15:40:23.234 Server version: SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2
. 2019-01-23 15:40:23.235 We believe remote version has SSH-2 channel request bug
. 2019-01-23 15:40:23.235 Using SSH protocol version 2
. 2019-01-23 15:40:23.235 Have a known host key of type ecdsa-sha2-nistp256
. 2019-01-23 15:40:23.491 Doing ECDH key exchange with curve nistp256 and hash SHA-256
. 2019-01-23 15:40:23.822 Server also has ssh-dss/ssh-rsa host keys, but we don't know any of them
. 2019-01-23 15:40:23.822 Host key fingerprint is:
. 2019-01-23 15:40:23.822 ecdsa-sha2-nistp256 256 f0:39:24:5c:63:12:5a:0d:e3:35:08:3d:91:d2:9f:53 7HbkGPzNm6tuAiqUoEpiHX4jxoNzxJgXQjWOgjuKGM8=
. 2019-01-23 15:40:23.871 Host key matches cached key
. 2019-01-23 15:40:23.871 Initialised AES-256 SDCTR client->server encryption
. 2019-01-23 15:40:23.871 Initialised HMAC-SHA-256 client->server MAC algorithm
. 2019-01-23 15:40:23.871 Initialised AES-256 SDCTR server->client encryption
. 2019-01-23 15:40:23.871 Initialised HMAC-SHA-256 server->client MAC algorithm
! 2019-01-23 15:40:24.426 Using username "root".
. 2019-01-23 15:40:24.744 Server offered these authentication methods: publickey,password,keyboard-interactive
. 2019-01-23 15:40:24.745 Attempting keyboard-interactive authentication
. 2019-01-23 15:40:25.002 Server refused keyboard-interactive authentication
. 2019-01-23 15:40:25.002 Server offered these authentication methods: publickey,password,keyboard-interactive
. 2019-01-23 15:40:25.002 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2019-01-23 15:40:25.002 Using stored password.
. 2019-01-23 15:40:25.059 Sent password
. 2019-01-23 15:40:25.331 Access granted
. 2019-01-23 15:40:25.331 Opening session as main channel
. 2019-01-23 15:40:25.585 Opened main channel
. 2019-01-23 15:40:26.134 Started a shell/command
. 2019-01-23 15:40:26.148 --------------------------------------------------------------------------
. 2019-01-23 15:40:26.148 Using SFTP protocol.
. 2019-01-23 15:40:26.149 Doing startup conversation with host.
. 2019-01-23 15:40:26.149 Server sent command exit status 127
. 2019-01-23 15:40:26.150 Disconnected: All channels closed
* 2019-01-23 15:40:26.187 (EFatal) **Connection has been unexpectedly closed.** Server sent command exit status 127.

задан
24 January 2019 в 18:00

поделиться

1 ответ

Для доступа к sftp от других хостов удостоверьтесь, что следующее установлено и настроено правильно.

  • Установленные серверы OpenSSH
  • Настроенный sshd_config
    • PubkeyAuthentication да
    • Подсистема sftp внутренний-sftp
  • Добавленный Ваш открытый ключ к ~/.ssh/authorized_keys

  • Запустите ssh сервер с порта, 22/TCP открытый # /etc/init.d/sshd start

  • # iptables -I INPUT -j ACCEPT -p tcp --dport 22

Наконец, тест $ sftp <login>@<hostname>

ответ дан Jay
7 December 2019 в 13:19

поделиться

Другие вопросы по тегам:

Похожие вопросы:

View previous topic :: View next topic  

Author Message
cherry
DD-WRT Novice

Joined: 25 Jan 2011
Posts: 36

PostPosted: Thu Mar 03, 2011 12:57    Post subject: Ошибки при подключении WinSCP Reply with quote
Железо Asus RT-N16

Прошивка DD-WRT v24-sp2 (02/17/11) big — build 16214

При подключении по WinSCP протокол SFTP выдает ошибку

«Не получается использовать SFTP. На сервере вообще запущен SFTP?» Сервер вернул код команды 127.

При подключении по протоколу SCP выдает ошибку «Команда «groups» завершилась с кодом ошибки 127 и сообщением -sh: groups: not found.»

Но подключается и работать можно, хотя и ругается при сохранении файлов.

На Asus WL-520gu и прошивке dd-wrt.v24-15943_NEWD-2_mini_usb_ftp все работало без проблем.

Виновата прошивка? Подскажите пожалуйста.
Back to top View user's profile Send private message
Sponsor
cherry
DD-WRT Novice

Joined: 25 Jan 2011
Posts: 36

PostPosted: Thu Mar 03, 2011 13:36    Post subject: Reply with quote
Если в WinSCP в настройках SCP/оболочка отключить группы пользователей, то по протоколу SCP ошибки не возникают.

А сервер SFTP видимо не включен в прошивку (-
Back to top View user's profile Send private message
Display posts from previous:    Page 1 of 1

Мой сервер — Ubuntu 14.04.5 LTS, и я могу подключиться по SSH в Putty, но не могу подключиться через WinSCP.

Когда я пытаюсь подключиться через WinSCP, выдает следующее сообщение об ошибке:

Соединение было неожиданно закрыто. сервер отправил команду о статусе выхода 127

2019-01-22 07:41

1
ответ

Решение

Чтобы получить доступ к вашему sftp с других хостов, пожалуйста, убедитесь, что следующее установлено и настроено правильно.

  • Установленные OpenSSH серверы
  • Настроил sshd_config
    • PubkeyAuthentication да
    • Подсистема sftp internal-sftp
  • Добавил ваш открытый ключ в ~/.ssh/authorized_keys

  • Запустите сервер SSH с открытым портом 22/TCP # /etc/init.d/sshd start

  • # iptables -I INPUT -j ACCEPT -p tcp --dport 22

Наконец, тест $ sftp <login>@<hostname>

2019-01-24 13:00

Понравилась статья? Поделить с друзьями:
  • Wow sirus ошибка spawn run exe
  • Winscp логи ошибок
  • Wow sirus ошибка 134
  • Winscp игнорировать ошибки прав доступа
  • Wow classic ошибка 132