scp command can't copy empty file - scp

i am trying to copy empty file with scp, this file is copied in remote server (Windows + SolarWinds SCP/SFTP server). No problem with non empty file.
However, i have this log:
Sending file modes: C0644 0 TEST_1
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
Connection to myserver closed by remote host.
Transferred: sent 1712, received 1392 bytes, in 122.4 seconds
Bytes per second: sent 14.0, received 11.4
debug1: Exit status -1
lost connection
or i can't have a return from command and i am forced to kill it.
Sending file modes: C0644 0 TEST_1
^C
[user#server ~]$ debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
Killed by signal 1.
So, the return code is 1 and my script returns a error code.

Related

Gitlab ssh connection timeout (with Cloudflare and Client crt)

I can't connect to my gitlab server. The webUI is secured with Cludflare and Client cert. But that should not really matter because I want to connect with ssh
ssh -Tvvv git#gitlab.domain
OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /home/userdir/.ssh/config
debug1: /home/userdir/.ssh/config line 1: Applying options for gitlab.domain
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/userdir/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/userdir/.ssh/known_hosts2'
debug2: resolving "gitlab.domain" port 12345
debug3: resolve_host: lookup gitlab.domain:12345
debug3: ssh_connect_direct: entering
debug1: Connecting to gitlab.domain [123.123.123.123] port 12345.
debug3: set_sock_tos: set socket 3 IP_TOS 0x10
debug1: connect to address 123.123.123.123 port 12345: Connection timed out
debug1: Connecting to gitlab.domain [123.123.123.123] port 12345.
debug3: set_sock_tos: set socket 3 IP_TOS 0x10
~/.ssh/config
Host gitlab.domain
HostName gitlab.domain
User gitlabuser
Port 12345
PreferredAuthentications publickey
IdentityFile ~/.ssh/git
(The key is stored in the corresponding account)
What could be the reason for this?
As long as a curl -v telnet://gitlab.domain:12345 shows you a timeout, that means:
either the network route is not opened between your machine and gitlab.domain:12345
or gitlab.domain does not listen on port 12345
Double-check your GitLab ssh port configuration and make sure it is up and running, using the port you need.

ansible *servergroup* -m win_ping throws error

I installed and configured ansible as per the instructions on the official documentation. The setup is as follows:
WIN 10 Enterprise VM Host runs the ansible control node which is
Ubuntu 20.04LTS VM in VirtualBox.
This control node then SSHs to a Linux server (this works just fine) or a Windows Server 2019.
As mentioned before the connection has to happen via SSH and not winrm.
After the setup yesterday I was able to win_ping the server. After that I changed the standard shell from cmd to PowerShell. win_pinged again and shut the VM off.
Today no changes whatsoever, I started the VM and for starters wanted to verify the connection and got an error back:
ansiblenode#ansiblenode-VirtualBox:~$ ansible windows-servers -m win_ping
[DEPRECATION WARNING]: The TRANSFORM_INVALID_GROUP_CHARS settings is set to allow bad characters in group names by default, this will
change, but still be user configurable on deprecation. This feature will be removed in version 2.10. Deprecation warnings can be
disabled by setting deprecation_warnings=False in ansible.cfg.
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
windowsTest_host1 | FAILED! => {
"changed": false,
"module_stderr": "At line:1 char:26\r\n+ chcp.com 65001 >nul 2>&1 && PowerShell -NoProfile -NonInteractive -Ex ...\r\n+ ~~\r\nThe token '&&' is not a valid statement separator in this version.\r\n + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException\r\n + FullyQualifiedErrorId : InvalidEndOfLine\r\n \r\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
Detailed Version with -vvvv:
windowsTest_host1 | FAILED! => {
"changed": false,
"module_stderr": "OpenSSH_8.2p1 Ubuntu-4ubuntu0.4, OpenSSL 1.1.1f 31 Mar 2020\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug2: resolve_canonicalize: hostname XXX.XX.XXX.XXX is address\r\ndebug1: auto-mux: Trying existing master\r\ndebug1: Control socket \"/home/ansiblenode/.ansible/cp/c7e43effac\" does not exist\r\ndebug2: ssh_connect_direct\r\ndebug1: Connecting to XXX.XX.XXX.XXX [XXX.XX.XXX.XXX] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: fd 3 clearing O_NONBLOCK\r\ndebug1: Connection established.\r\ndebug3: timeout: 9980 ms remain after connect\r\ndebug1: identity file /home/ansiblenode/.ssh/id_rsa type -1\r\ndebug1: identity file /home/ansiblenode/.ssh/id_rsa-cert type -1\r\ndebug1: identity file /home/ansiblenode/.ssh/id_dsa type -1\r\ndebug1: identity file /home/ansiblenode/.ssh/id_dsa-cert type -1\r\ndebug1: identity file /home/ansiblenode/.ssh/id_ecdsa type -1\r\ndebug1: identity file /home/ansiblenode/.ssh/id_ecdsa-cert type -1\r\ndebug1: identity file /home/ansiblenode/.ssh/id_ecdsa_sk type -1\r\ndebug1: identity file /home/ansiblenode/.ssh/id_ecdsa_sk-cert type -1\r\ndebug1: identity file /home/ansiblenode/.ssh/id_ed25519 type -1\r\ndebug1: identity file /home/ansiblenode/.ssh/id_ed25519-cert type -1\r\ndebug1: identity file /home/ansiblenode/.ssh/id_ed25519_sk type -1\r\ndebug1: identity file /home/ansiblenode/.ssh/id_ed25519_sk-cert type -1\r\ndebug1: identity file /home/ansiblenode/.ssh/id_xmss type -1\r\ndebug1: identity file /home/ansiblenode/.ssh/id_xmss-cert type -1\r\ndebug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.4\r\ndebug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_8.6\r\ndebug1: match: OpenSSH_for_Windows_8.6 pat OpenSSH* compat 0x04000000\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: Authenticating to XXX.XX.XXX.XXX:22 as 'Administrator'\r\ndebug3: hostkeys_foreach: reading file \"/home/ansiblenode/.ssh/known_hosts\"\r\ndebug3: record_hostkey: found key type ECDSA in file /home/ansiblenode/.ssh/known_hosts:1\r\ndebug3: load_hostkeys: loaded 1 keys from XXX.XX.XXX.XXX\r\ndebug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01#openssh.com,ecdsa-sha2-nistp384-cert-v01#openssh.com,ecdsa-sha2-nistp521-cert-v01#openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521\r\ndebug3: send packet: type 20\r\ndebug1: SSH2_MSG_KEXINIT sent\r\ndebug3: receive packet: type 20\r\ndebug1: SSH2_MSG_KEXINIT received\r\ndebug2: local client KEXINIT proposal\r\ndebug2: KEX algorithms: curve25519-sha256,curve25519-sha256#libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c\r\ndebug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01#openssh.com,ecdsa-sha2-nistp384-cert-v01#openssh.com,ecdsa-sha2-nistp521-cert-v01#openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256-cert-v01#openssh.com,ssh-ed25519-cert-v01#openssh.com,sk-ssh-ed25519-cert-v01#openssh.com,rsa-sha2-512-cert-v01#openssh.com,rsa-sha2-256-cert-v01#openssh.com,ssh-rsa-cert-v01#openssh.com,sk-ecdsa-sha2-nistp256#openssh.com,ssh-ed25519,sk-ssh-ed25519#openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa\r\ndebug2: ciphers ctos: chacha20-poly1305#openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm#openssh.com,aes256-gcm#openssh.com\r\ndebug2: ciphers stoc: chacha20-poly1305#openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm#openssh.com,aes256-gcm#openssh.com\r\ndebug2: MACs ctos: umac-64-etm#openssh.com,umac-128-etm#openssh.com,hmac-sha2-256-etm#openssh.com,hmac-sha2-512-etm#openssh.com,hmac-sha1-etm#openssh.com,umac-64#openssh.com,umac-128#openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1\r\ndebug2: MACs stoc: umac-64-etm#openssh.com,umac-128-etm#openssh.com,hmac-sha2-256-etm#openssh.com,hmac-sha2-512-etm#openssh.com,hmac-sha1-etm#openssh.com,umac-64#openssh.com,umac-128#openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1\r\ndebug2: compression ctos: zlib#openssh.com,zlib,none\r\ndebug2: compression stoc: zlib#openssh.com,zlib,none\r\ndebug2: languages ctos: \r\ndebug2: languages stoc: \r\ndebug2: first_kex_follows 0 \r\ndebug2: reserved 0 \r\ndebug2: peer server KEXINIT proposal\r\ndebug2: KEX algorithms: curve25519-sha256,curve25519-sha256#libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256\r\ndebug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519\r\ndebug2: ciphers ctos: chacha20-poly1305#openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm#openssh.com,aes256-gcm#openssh.com\r\ndebug2: ciphers stoc: chacha20-poly1305#openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm#openssh.com,aes256-gcm#openssh.com\r\ndebug2: MACs ctos: umac-64-etm#openssh.com,umac-128-etm#openssh.com,hmac-sha2-256-etm#openssh.com,hmac-sha2-512-etm#openssh.com,hmac-sha1-etm#openssh.com,umac-64#openssh.com,umac-128#openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1\r\ndebug2: MACs stoc: umac-64-etm#openssh.com,umac-128-etm#openssh.com,hmac-sha2-256-etm#openssh.com,hmac-sha2-512-etm#openssh.com,hmac-sha1-etm#openssh.com,umac-64#openssh.com,umac-128#openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1\r\ndebug2: compression ctos: none,zlib#openssh.com\r\ndebug2: compression stoc: none,zlib#openssh.com\r\ndebug2: languages ctos: \r\ndebug2: languages stoc: \r\ndebug2: first_kex_follows 0 \r\ndebug2: reserved 0 \r\ndebug1: kex: algorithm: curve25519-sha256\r\ndebug1: kex: host key algorithm: ecdsa-sha2-nistp256\r\ndebug1: kex: server->client cipher: chacha20-poly1305#openssh.com MAC: <implicit> compression: zlib#openssh.com\r\ndebug1: kex: client->server cipher: chacha20-poly1305#openssh.com MAC: <implicit> compression: zlib#openssh.com\r\ndebug3: send packet: type 30\r\ndebug1: expecting SSH2_MSG_KEX_ECDH_REPLY\r\ndebug3: receive packet: type 31\r\ndebug1: Server host key: XXXXXXXXXX
hostkeys_foreach: reading file \"/home/ansiblenode/.ssh/known_hosts\"\r\ndebug3: record_hostkey: found key type ECDSA in file /home/ansiblenode/.ssh/known_hosts:1\r\ndebug3: load_hostkeys: loaded 1 keys from XXX.XX.XXX.XXX\r\ndebug1: Host 'XXX.XX.XXX.XXX' is known and matches the ECDSA host key.\r\ndebug1: Found key in /home/ansiblenode/.ssh/known_hosts:1\r\ndebug3: send packet: type 21\r\ndebug2: set_newkeys: mode 1\r\ndebug1: rekey out after 134217728 blocks\r\ndebug1: SSH2_MSG_NEWKEYS sent\r\ndebug1: expecting SSH2_MSG_NEWKEYS\r\ndebug3: receive packet: type 21\r\ndebug1: SSH2_MSG_NEWKEYS received\r\ndebug2: set_newkeys: mode 0\r\ndebug1: rekey in after 134217728 blocks\r\ndebug1: Will attempt key: /home/ansiblenode/.ssh/id_rsa \r\ndebug1: Will attempt key: /home/ansiblenode/.ssh/id_dsa \r\ndebug1: Will attempt key: /home/ansiblenode/.ssh/id_ecdsa \r\ndebug1: Will attempt key: /home/ansiblenode/.ssh/id_ecdsa_sk \r\ndebug1: Will attempt key: /home/ansiblenode/.ssh/id_ed25519 \r\ndebug1: Will attempt key: /home/ansiblenode/.ssh/id_ed25519_sk \r\ndebug1: Will attempt key: /home/ansiblenode/.ssh/id_xmss \r\ndebug2: pubkey_prepare: done\r\ndebug3: send packet: type 5\r\ndebug3: receive packet: type 7\r\ndebug1: SSH2_MSG_EXT_INFO received\r\ndebug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519#openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256#openssh.com,webauthn-sk-ecdsa-sha2-nistp256#openssh.com>\r\ndebug3: receive packet: type 6\r\ndebug2: service_accept: ssh-userauth\r\ndebug1: SSH2_MSG_SERVICE_ACCEPT received\r\ndebug3: send packet: type 50\r\ndebug3: receive packet: type 51\r\ndebug1: Authentications that can continue: publickey,password,keyboard-interactive\r\ndebug3: start over, passed a different list publickey,password,keyboard-interactive\r\ndebug3: preferred gssapi-with-mic,publickey,keyboard-interactive,password\r\ndebug3: authmethod_lookup publickey\r\ndebug3: remaining preferred: keyboard-interactive,password\r\ndebug3: authmethod_is_enabled publickey\r\ndebug1: Next authentication method: publickey\r\ndebug1: Trying private key: /home/ansiblenode/.ssh/id_rsa\r\ndebug3: no such identity: /home/ansiblenode/.ssh/id_rsa: No such file or directory\r\ndebug1: Trying private key: /home/ansiblenode/.ssh/id_dsa\r\ndebug3: no such identity: /home/ansiblenode/.ssh/id_dsa: No such file or directory\r\ndebug1: Trying private key: /home/ansiblenode/.ssh/id_ecdsa\r\ndebug3: no such identity: /home/ansiblenode/.ssh/id_ecdsa: No such file or directory\r\ndebug1: Trying private key: /home/ansiblenode/.ssh/id_ecdsa_sk\r\ndebug3: no such identity: /home/ansiblenode/.ssh/id_ecdsa_sk: No such file or directory\r\ndebug1: Trying private key: /home/ansiblenode/.ssh/id_ed25519\r\ndebug3: no such identity: /home/ansiblenode/.ssh/id_ed25519: No such file or directory\r\ndebug1: Trying private key: /home/ansiblenode/.ssh/id_ed25519_sk\r\ndebug3: no such identity: /home/ansiblenode/.ssh/id_ed25519_sk: No such file or directory\r\ndebug1: Trying private key: /home/ansiblenode/.ssh/id_xmss\r\ndebug3: no such identity: /home/ansiblenode/.ssh/id_xmss: No such file or directory\r\ndebug2: we did not send a packet, disable method\r\ndebug3: authmethod_lookup keyboard-interactive\r\ndebug3: remaining preferred: password\r\ndebug3: authmethod_is_enabled keyboard-interactive\r\ndebug1: Next authentication method: keyboard-interactive\r\ndebug2: userauth_kbdint\r\ndebug3: send packet: type 50\r\ndebug2: we sent a keyboard-interactive packet, wait for reply\r\ndebug3: receive packet: type 51\r\ndebug1: Authentications that can continue: publickey,password,keyboard-interactive\r\ndebug3: userauth_kbdint: disable: no info_req_seen\r\ndebug2: we did not send a packet, disable method\r\ndebug3: authmethod_lookup password\r\ndebug3: remaining preferred: \r\ndebug3: authmethod_is_enabled password\r\ndebug1: Next authentication method: password\r\ndebug3: send packet: type 50\r\ndebug2: we sent a password packet, wait for reply\r\ndebug3: receive packet: type 52\r\ndebug1: Enabling compression at level 6.\r\ndebug1: Authentication succeeded (password).\r\nAuthenticated to XXX.XX.XXX.XXX ([XXX.XX.XXX.XXX]:22).\r\ndebug1: setting up multiplex master socket\r\ndebug3: muxserver_listen: temporary control path /home/ansiblenode/.ansible/cp/c7e43effac.bc3nbpSV394EBUJr\r\ndebug2: fd 4 setting O_NONBLOCK\r\ndebug3: fd 4 is O_NONBLOCK\r\ndebug3: fd 4 is O_NONBLOCK\r\ndebug1: channel 0: new [/home/ansiblenode/.ansible/cp/c7e43effac]\r\ndebug3: muxserver_listen: mux listener channel 0 fd 4\r\ndebug2: fd 3 setting TCP_NODELAY\r\ndebug3: ssh_packet_set_tos: set IP_TOS 0x08\r\ndebug1: control_persist_detach: backgrounding master process\r\ndebug2: control_persist_detach: background process is 3177\r\ndebug2: fd 4 setting O_NONBLOCK\r\ndebug1: forking to background\r\ndebug1: Entering interactive session.\r\ndebug1: pledge: id\r\ndebug2: set_control_persist_exit_time: schedule exit in 60 seconds\r\ndebug1: multiplexing control connection\r\ndebug2: fd 5 setting O_NONBLOCK\r\ndebug3: fd 5 is O_NONBLOCK\r\ndebug1: channel 1: new [mux-control]\r\ndebug3: channel_post_mux_listener: new mux channel 1 fd 5\r\ndebug3: mux_master_read_cb: channel 1: hello sent\r\ndebug2: set_control_persist_exit_time: cancel scheduled exit\r\ndebug3: mux_master_read_cb: channel 1 packet type 0x00000001 len 4\r\ndebug2: mux_master_process_hello: channel 1 slave version 4\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_master_read_cb: channel 1 packet type 0x10000004 len 4\r\ndebug2: mux_master_process_alive_check: channel 1: alive check\r\ndebug3: mux_client_request_alive: done pid = 3179\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_master_read_cb: channel 1 packet type 0x10000002 len 3122\r\ndebug2: mux_master_process_new_session: channel 1: request tty 0, X 0, agent 0, subsys 0, term \"xterm-256color\", cmd \"chcp.com 65001 >nul 2>&1 && PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -EncodedCommand UABvAHcAZQByAFMAaABlAGwAbAAgAC0ATgBvAFAAcgBvAGYAaQBsAGUAIAAtAE4AbwBuAEkAbgB0AGUAcgBhAGMAdABpAHYAZQAgAC0ARQB4AGUAYwB1AHQAaQBvAG4AUABvAGwAaQBjAHkAIABVAG4AcgBlAHMAdAByAGkAYwB0AGUAZAAgAC0ARQBuAGMAbwBkAGUAZABDAG8AbQBtAGEAbgBkACAASgBnAEIAagBBAEcAZwBBAFkAdwBCAHcAQQBDADQAQQBZAHcAQgB2AEEARwAwAEEASQBBAEEAMgBBAEQAVQBBAE0AQQBBAHcAQQBEAEUAQQBJAEEAQQArAEEAQwBBAEEASgBBAEIAdQBBAEgAVQBBAGIAQQBCAHMAQQBBAG8AQQBKAEEAQgBsAEEASABnAEEAWgBRAEIAagBBAEYAOABBAGQAdwBCAHkAQQBHAEUAQQBjAEEAQgB3AEEARwBVAEEAYwBnAEIAZgBBAEgATQBBAGQAQQBCAHkAQQBDAEEAQQBQAFEAQQBnAEEAQwBRAEEAYQBRAEIAdQBBAEgAQQBBAGQAUQBCADAAQQBDAEEAQQBmAEEAQQBnAEEARQA4AEEAZABRAEIAMABBAEMAMABBAFUAdwBCADAAQQBIAEkAQQBhAFEAQgB1AEEARwBjAEEAQwBnAEEAawBBAEgATQBBAGMAQQBCAHMAQQBHAGsAQQBkAEEAQgBmAEEASABBAEEAWQBRAEIAeQBBAEgAUQBBAGMAdwBBAGcAQQBEADAAQQBJAEEAQQBrAEE\r\ndebug3: mux_master_process_new_session: got fds stdin 6, stdout 7, stderr 8\r\ndebug2: fd 6 setting O_NONBLOCK\r\ndebug2: fd 7 setting O_NONBLOCK\r\ndebug2: fd 8 setting O_NONBLOCK\r\ndebug1: channel 2: new [client-session]\r\ndebug2: mux_master_process_new_session: channel_new: 2 linked to control channel 1\r\ndebug2: channel 2: send open\r\ndebug3: send packet: type 90\r\ndebug3: receive packet: type 80\r\ndebug1: client_input_global_request: rtype hostkeys-00#openssh.com want_reply 0\r\ndebug3: receive packet: type 91\r\ndebug2: channel_input_open_confirmation: channel 2: callback start\r\ndebug2: client_session2_setup: id 2\r\ndebug1: Sending environment.\r\ndebug1: Sending env LC_ADDRESS = de_DE.UTF-8\r\ndebug2: channel 2: request env confirm 0\r\ndebug3: send packet: type 98\r\ndebug1: Sending env LC_NAME = de_DE.UTF-8\r\ndebug2: channel 2: request env confirm 0\r\ndebug3: send packet: type 98\r\ndebug1: Sending env LC_MONETARY = de_DE.UTF-8\r\ndebug2: channel 2: request env confirm 0\r\ndebug3: send packet: type 98\r\ndebug1: Sending env LC_PAPER = de_DE.UTF-8\r\ndebug2: channel 2: request env confirm 0\r\ndebug3: send packet: type 98\r\ndebug1: Sending env LANG = en_US.UTF-8\r\ndebug2: channel 2: request env confirm 0\r\ndebug3: send packet: type 98\r\ndebug1: Sending env LC_IDENTIFICATION = de_DE.UTF-8\r\ndebug2: channel 2: request env confirm 0\r\ndebug3: send packet: type 98\r\ndebug1: Sending env LC_TELEPHONE = de_DE.UTF-8\r\ndebug2: channel 2: request env confirm 0\r\ndebug3: send packet: type 98\r\ndebug1: Sending env LC_MEASUREMENT = de_DE.UTF-8\r\ndebug2: channel 2: request env confirm 0\r\ndebug3: send packet: type 98\r\ndebug1: Sending env LC_TIME = de_DE.UTF-8\r\ndebug2: channel 2: request env confirm 0\r\ndebug3: send packet: type 98\r\ndebug1: Sending env LC_NUMERIC = de_DE.UTF-8\r\ndebug2: channel 2: request env confirm 0\r\ndebug3: send packet: type 98\r\ndebug1: Sending command: chcp.com 65001 >nul 2>&1 && PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -EncodedCommand UABvAHcAZQByAFMAaABlAGwAbAAgAC0ATgBvAFAAcgBvAGYAaQBsAGUAIAAtAE4AbwBuAEkAbgB0AGUAcgBhAGMAdABpAHYAZQAgAC0ARQB4AGUAYwB1AHQAaQBvAG4AUABvAGwAaQBjAHkAIABVAG4AcgBlAHMAdAByAGkAYwB0AGUAZAAgAC0ARQBuAGMAbwBkAGUAZABDAG8AbQBtAGEAbgBkACAASgBnAEIAagBBAEcAZwBBAFkAdwBCAHcAQQBDADQAQQBZAHcAQgB2AEEARwAwAEEASQBBAEEAMgBBAEQAVQBBAE0AQQBBAHcAQQBEAEUAQQBJAEEAQQArAEEAQwBBAEEASgBBAEIAdQBBAEgAVQBBAGIAQQBCAHMAQQBBAG8AQQBKAEEAQgBsAEEASABnAEEAWgBRAEIAagBBAEYAOABBAGQAdwBCAHkAQQBHAEUAQQBjAEEAQgB3AEEARwBVAEEAYwBnAEIAZgBBAEgATQBBAGQAQQBCAHkAQQBDAEEAQQBQAFEAQQBnAEEAQwBRAEEAYQBRAEIAdQBBAEgAQQBBAGQAUQBCADAAQQBDAEEAQQBmAEEAQQBnAEEARQA4AEEAZABRAEIAMABBAEMAMABBAFUAdwBCADAAQQBIAEkAQQBhAFEAQgB1AEEARwBjAEEAQwBnAEEAawBBAEgATQBBAGMAQQBCAHMAQQBHAGsAQQBkAEEAQgBmAEEASABBAEEAWQBRAEIAeQBBAEgAUQBBAGMAdwBBAGcAQQBEADAAQQBJAEEAQQBr\r\ndebug2: channel 2: request exec confirm 1\r\ndebug3: send packet: type 98\r\ndebug3: mux_session_confirm: sending success reply\r\ndebug2: channel_input_open_confirmation: channel 2: callback done\r\ndebug2: channel 2: open confirm rwindow 0 rmax 32768\r\ndebug2: channel 2: rcvd adjust 2097152\r\ndebug3: receive packet: type 99\r\ndebug2: channel_input_status_confirm: type 99 id 2\r\ndebug2: exec request accepted on channel 2\r\ndebug2: channel 2: read<=0 rfd 6 len 0\r\ndebug2: channel 2: read failed\r\ndebug2: channel 2: chan_shutdown_read (i0 o0 sock -1 wfd 6 efd 8 [write])\r\ndebug2: channel 2: input open -> drain\r\ndebug2: channel 2: ibuf empty\r\ndebug2: channel 2: send eof\r\ndebug3: send packet: type 96\r\ndebug2: channel 2: input drain -> closed\r\ndebug2: channel 2: rcvd adjust 16384\r\ndebug2: channel 2: rcvd ext data 19\r\nAt line:1 char:26\r\ndebug2: channel 2: written 19 to efd 8\r\ndebug2: channel 2: rcvd ext data 77\r\ndebug2: channel 2: rcvd ext data 31\r\ndebug2: channel 2: rcvd ext data 68\r\ndebug2: channel 2: rcvd ext data 87\r\ndebug2: channel 2: rcvd ext data 48\r\n+ chcp.com 65001 >nul 2>&1 && PowerShell -NoProfile -NonInteractive -Ex ...\r\n+ ~~\r\nThe token '&&' is not a valid statement separator in this version.\r\n + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException\r\n + FullyQualifiedErrorId : InvalidEndOfLine\r\ndebug2: channel 2: written 311 to efd 8\r\ndebug2: channel 2: rcvd ext data 3\r\n \r\ndebug2: channel 2: written 3 to efd 8\r\ndebug3: receive packet: type 98\r\ndebug1: client_input_channel_req: channel 2 rtype eow#openssh.com reply 0\r\ndebug2: channel 2: rcvd eow\r\ndebug3: receive packet: type 96\r\ndebug2: channel 2: rcvd eof\r\ndebug2: channel 2: output open -> drain\r\ndebug2: channel 2: obuf empty\r\ndebug2: channel 2: chan_shutdown_write (i3 o1 sock -1 wfd 7 efd 8 [write])\r\ndebug2: channel 2: output drain -> closed\r\ndebug2: channel 2: send close\r\ndebug3: send packet: type 97\r\ndebug3: channel 2: will not send data after close\r\ndebug3: receive packet: type 98\r\ndebug1: client_input_channel_req: channel 2 rtype exit-status reply 0\r\ndebug3: mux_exit_message: channel 2: exit message, exitval 1\r\ndebug3: receive packet: type 97\r\ndebug2: channel 2: rcvd close\r\ndebug3: channel 2: will not send data after close\r\ndebug2: channel 2: is dead\r\ndebug2: channel 2: gc: notify user\r\ndebug3: mux_master_session_cleanup_cb: entering for channel 2\r\ndebug2: channel 1: rcvd close\r\ndebug2: channel 1: output open -> drain\r\ndebug2: channel 1: chan_shutdown_read (i0 o1 sock 5 wfd 5 efd -1 [closed])\r\ndebug2: channel 1: input open -> closed\r\ndebug2: channel 2: gc: user detached\r\ndebug2: channel 2: is dead\r\ndebug2: channel 2: garbage collecting\r\ndebug1: channel 2: free: client-session, nchannels 3\r\ndebug3: channel 2: status: The following connections are open:\r\n #1 mux-control (t16 nr0 i3/0 o1/16 e[closed]/0 fd 5/5/-1 sock 5 cc -1)\r\n #2 client-session (t4 r0 i3/0 o3/0 e[write]/0 fd -1/-1/8 sock -1 cc -1)\r\n\r\ndebug2: channel 1: obuf empty\r\ndebug2: channel 1: chan_shutdown_write (i3 o1 sock 5 wfd 5 efd -1 [closed])\r\ndebug2: channel 1: output drain -> closed\r\ndebug2: channel 1: is dead (local)\r\ndebug2: channel 1: gc: notify user\r\ndebug3: mux_master_control_cleanup_cb: entering for channel 1\r\ndebug2: channel 1: gc: user detached\r\ndebug2: channel 1: is dead (local)\r\ndebug2: channel 1: garbage collecting\r\ndebug1: channel 1: free: mux-control, nchannels 2\r\ndebug3: channel 1: status: The following connections are open:\r\n #1 mux-control (t16 nr0 i3/0 o3/0 e[closed]/0 fd 5/5/-1 sock 5 cc -1)\r\n\r\ndebug2: set_control_persist_exit_time: schedule exit in 60 seconds\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 1\r\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
Does sbdy know where these errors are coming from?
The error the that's actually thrown is even larger than what I posted in the second codesnippet. For some reason it won't paste the full version though.
(Maybe I do have to change the language from JS, but to what I don't know)
Thanks for you're help.
EDIT1:
I did find that line in the logs:
<XXX.XX.XXX.XXX> SSH: EXEC sshpass -d11 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="Administrator"' -o ConnectTimeout=10 -o ControlPath=/home/ansiblenode/.ansible/cp/c7e43effac XXX.XX.XXX.XXX 'chcp.com 65001 >nul 2>&1 && PowerShell -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -EncodedCommand
Failed to connect to the host via ssh: At line:1 char:26 + chcp.com 65001 >nul 2>&1 && PowerShell -NoProfile -NonInteractive -Ex ...
This appears to be what the error is pointing to, but I lack the knowledge to know where to find and how to change and to what value.
EDIT2:
As far as I understand it has something to do with cmd vs PowerShell Commands.
Maybe there is something to change in addition to what is outlined in the officle ansible docs.
I was under the impression that when working with ansible one should change the default shell to PowerShell?
I forgot that for previous reasons I had specified the
ansible_shell_type=cmd
in the hosts file for windows-servers
ansible_shell_type=powershell
now works just fine.
Maybe would've gotten to the solution faster if I didn't convince myself that I had done another thestrun after changing the default shell to powershell.
Maybe it helps someone else to remember to check their hosts file.

sshpass does not work at HPUX 11.31

Does anyone successfully run sshpass at HPUX 11.31 ?
I’ve compiled sshpass 1.06 at HPUX 1131, but when I run it, I got errors.
The command I run :
sshpass -p Abcd1234 ssh -vvv nledfd02 date
I am able to connect by entering a password. Thus, the command ssh -vvv nledfd02 date works fine.
The error message in the console output :
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug3: packet_send2: adding 64 (len 50 padlen 14 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: Authentications that can continue: password,keyboard-interactive
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug3: packet_send2: adding 64 (len 50 padlen 14 extra_pad 64)
debug2: we sent a password packet, wait for reply
Received disconnect from 10.8.65.51: 2: Too many authentication failures for test1
The error message in sshd output :
root#NLEDFD02 [/tmp/sshpass/sshpass105]
# /opt/ssh/sbin/sshd -d
Postponed keyboard-interactive for test1 from 10.8.65.51 port 52444 ssh2 [preauth]
PAM: Authentication failed for test1 from 10.8.65.51
Failed keyboard-interactive/pam for test1 from 10.8.65.51 port 52444 ssh2
debug1: Entering record_failed_login uid 0
debug1: audit event euid 0 user test1 event 5 (AUTH_FAIL_KBDINT)
debug1: aud_sav_flag=1
debug1: userauth-request for user test1 service ssh-connection method password [preauth]
debug1: attempt 4 failures 3 [preauth]
Failed none for test1 from 10.8.65.51 port 52444 ssh2
debug1: audit event euid 0 user test1 event 3 (AUTH_FAIL_NONE)
debug1: userauth-request for user test1 service ssh-connection method password [preauth]
debug1: attempt 5 failures 4 [preauth]
Failed password for test1 from 10.8.65.51 port 52444 ssh2
debug1: Entering record_failed_login uid 0
debug1: audit event euid 0 user test1 event 4 (AUTH_FAIL_PASSWD)
debug1: aud_sav_flag=1
Disconnecting: Too many authentication failures for test1 [preauth]
debug1: do_cleanup [preauth]
debug1: monitor_read_log: child log fd closed
debug1: audit event euid 0 user test1 event 0 (LOGIN_EXCEED_MAXTRIES)
debug1: aud_sav_flag=1
debug1: do_cleanup
debug1: PAM: cleanup
debug1: Killing privsep child 21704
debug1: audit event euid 0 user test1 event 12 (CONNECTION_ABANDON)
debug1: aud_sav_flag=1
root#NLEDFD02 [/tmp/sshpass/sshpass105]
# uname -a
HP-UX NLEDFD02 B.11.31 U ia64 3687447314 unlimited-user license
root#NLEDFD02 [/tmp/sshpass/sshpass105]
# cc -V
(Bundled) cc: HP C/aC++ B3910B A.06.12 [Oct 11 2006]
root#NLEDFD02 [/tmp/sshpass/sshpass105]
# ssh -version
OpenSSH_6.2p1+sftpfilecontrol-v1.3-hpn13v12, OpenSSL 0.9.8y 5 Feb 2013
HP-UX Secure Shell-A.06.20.006, HP-UX Secure Shell version

ssh remote command not executed on openBSD

Trying to execute command via ssh, but I'm not receiving anything back. The server A is Solaris machine and Server B is SUSE linux with OpenBSD sshd. Checked
ssh remote command does not return
https://www.openbsd.org/papers/auug2002-ssh.pdf
https://superuser.com/questions/792070/commands-over-ssh-not-producing-output
and other sources, but can't resolve it.
The command I'm trying is (in bash):
ssh -v -i .ssh/id_rsa -p1234 user2#abcdefg 'ls'
(tried without quotes and with double quotes as well )
And the debug info I'm receiving is :
Sun_SSH_1.1.6, SSH protocols 1.5/2.0, OpenSSL 0x0090704f
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Rhosts Authentication disabled, originating port will not be trusted.
debug1: ssh_connect: needpriv 0
debug1: Connecting to ABCDEFG [100.100.100.100] port 1234.
debug1: Connection established.
debug1: identity file ../../../.ssh/id_rsa type 1
debug1: Logging to host: abcdefg
debug1: Local user: user1 Remote user: user2
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.2
debug1: match: OpenSSH_6.2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-Sun_SSH_1.1.6
debug1: use_engine is 'yes'
debug1: pkcs11 engine initialized, now setting it as default for RSA, DSA, and symmetric ciphers
debug1: pkcs11 engine initialization complete
debug1: Failed to acquire GSS-API credentials for any mechanisms (No credentials were supplied, or the credentials were unavailable or inaccessible
Unknown code 0
)
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: Peer sent proposed langtags, ctos:
debug1: Peer sent proposed langtags, stoc:
debug1: We proposed langtags, ctos: i-default
debug1: We proposed langtags, stoc: i-default
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: dh_gen_key: priv key bits set: 128/256
debug1: bits set: 1014/2048
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'abcdefg' is known and matches the RSA host key.
debug1: Found key in /home/user1/.ssh/known_hosts:1
debug1: bits set: 1019/2048
debug1: ssh_rsa_verify: signature correct
debug1: newkeys: mode 1
debug1: set_newkeys: setting new keys for 'out' mode
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: newkeys: mode 0
debug1: set_newkeys: setting new keys for 'in' mode
debug1: SSH2_MSG_NEWKEYS received
debug1: done: ssh_kex2.
debug1: send SSH2_MSG_SERVICE_REQUEST
debug1: got SSH2_MSG_SERVICE_ACCEPT
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying public key: .ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 149 lastkey 80b0320 hint 0
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey)
debug1: SSH receive window size: 198720 B
debug1: channel 0: new [client-session]
debug1: send channel open 0
debug1: Entering interactive session.
debug1: ssh_session2_setup: id 0
debug1: Sending command: ls
debug1: channel request 0: exec
debug1: channel 0: open confirm rwindow 0 rmax 32768
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: rcvd eof
debug1: channel 0: output open -> drain
debug1: channel 0: obuf empty
debug1: channel 0: close_write
debug1: channel 0: output drain -> closed
debug1: channel 0: rcvd close
debug1: channel 0: close_read
debug1: channel 0: input open -> closed
debug1: channel 0: almost dead
debug1: channel 0: gc: notify user
debug1: channel 0: gc: user detached
debug1: channel 0: send close
debug1: channel 0: is dead
debug1: channel 0: garbage collecting
debug1: channel_free: channel 0: client-session, nchannels 1
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.1 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status 1
The ssh_config file on serverB looks like:
# $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Configuration file set-up to meet APG43L needs.
Protocol 2
PasswordAuthentication yes
UsePAM yes
################################################################################
# Access to sftp subsystem is DISABLED #
# Subsystem sftp internal-sftp #
################################################################################
PermitRootLogin no
Ciphers aes128-ctr,aes256-ctr,arcfour256,arcfour,aes128-cbc,aes256-cbc
PrintLastLog no
Port 1234
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile .ssh/authorized_keys
AllowGroups group1 group2 group3
AllowUsers user2
RSAAuthentication yes
PubkeyAuthentication yes4
EDIT:
I tried to execute the commandon the remote machine and redirect its output to remote file, but this doesn't work either. No file is created ( I can write that file in the directory if I'm on remote server). I adapted the question also.
ssh -v -i .ssh/id_rsa -p1234 user2#abcdefg 'ls > output.dat'
Weird, certainly not your command -- similar with single quotes works for me. I get the same debug output to "debug1: Sending command: ls") so everything is authenticating fine, but you're just not getting the output I then get!
Some googling implies this variation on the command gets results
echo 'ls' | ssh -v -i .ssh/id_rsa -p1234 user2#abcdefg
https://superuser.com/questions/792070/commands-over-ssh-not-producing-output
I'm assuming you have executable rights to your home directory (be amazed if you didn't)... but assumption is the mother of all f ups, so do check you can actually ls on the actual client.

Scp fails in one direction for admin but is successful with root user

I am able to do a scp from server A to another server B using admin but the same admin is not able to send files back from server B to server A. I used scp -vv and the detials look as below:
Can a admin not scp files in some cases? if so how do I check the previlidges?
Executing: program /usr/local/bin/ssh host 140.199.280.888, user adm, command scp -v -t /home/adm/test
OpenSSH_4.3p2, OpenSSL 0.9.8e 23 Feb 2007
debug1: Reading configuration data /usr/local/etc/ssh_config
debug1: Connecting to 140.199.280.888 [140.199.280.888 port 22.
debug1: Connection established.
debug1: identity file /home/pro/.ssh/identity type -1
debug1: identity file /home/pro/.ssh/id_rsa type -1
debug1: identity file /home/pro/.ssh/id_dsa type -1
debug1: Remote protocol version 1.99, remote software version OpenSSH_4.3
debug1: match: OpenSSH_4.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '140.199.280.888' is known and matches the RSA host key.
debug1: Found key in /home/prov/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
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,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /home/pro/.ssh/identity
debug1: Trying private key: /home/pro/.ssh/id_rsa
debug1: Trying private key: /home/pro/.ssh/id_dsa
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
adm#140.199.280.888's password:
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending command: scp -v -t /home/adm/test
Setting up release specific environment variables...
debug2: we sent a password packet, wait for reply
debug1: Authentication succeeded (password).
debug2: fd 6 setting O_NONBLOCK
debug2: fd 7 setting O_NONBLOCK
debug1: channel 0: new [client-session]
debug2: channel 0: send open
debug1: Entering interactive session.
debug2: callback start
debug2: client_session2_setup: id 0
debug1: Sending command: scp -v -t /home/adm/test/
debug2: channel 0: request exec confirm 0
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 131072
Setting up release specific environment variables...
debug2: channel 0: read<=0 rfd 6 len 0
debug2: channel 0: read failed
debug2: channel 0: close_read
debug2: channel 0: input open -> drain
debug2: channel 0: ibuf empty
debug2: channel 0: send eof
debug2: channel 0: input drain -> closed
adm#pro% debug2: channel 0: write failed
debug2: channel 0: close_write
debug2: channel 0: output open -> closed
debug2: channel 0: rcvd eof
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug2: channel 0: rcvd close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.3 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status 0
How could I resolve this. Or wht am I missing here.
This looks like a known issue .bashrc and scp (excacly output from bash and non interactive shell). I solved this problem by modifying the part of .bashrc to execute only for interactive shell
case $- in
*i*) # interactive shell
alias cc='clearCache.sh'
echo 'Alias:
cc - clear cache
;;
esac
Links to such problems:
http://www.linuxquestions.org/questions/linux-server-73/strange-scp-error-and-fail-664945/
https://bugzilla.redhat.com/show_bug.cgi?id=20527
https://serverfault.com/questions/485487/use-bashrc-without-breaking-sftp