getting error to tranfer files from local to AWS ec2 instance - linux

Already SSH with the help of putty into AWS EC2 instance, Now, using rsync with the following command.I am using Windows 10.
rsync -av /Users/Lenovo/Desktop/dir1/* ec2-user#xx.xxx.xxx.xxx:/file
file is a directory which is created in the ec2 instance on Remote.
Followed this post but not able to resolve.
Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(600) [sender=3.0.6]

Related

Linux - Cannot Move Files with Rsync

I am having an error while moving files in Centos, the error is:
rsync: connection unexpectedly closed (643758 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.2]
It happens to be at the end of the copy process, i saw similar issues online but those issues related with no copying whatsoever, i have 643758 bytes of data moved but cannot finalize it somehow.
Any help will be appreciated.

Bitvise : the ssh session has terminated with error. reason flowsocketreader: Error receiving bytes. Windows error 10054

I'm using Debian and connecting it to Bit vise SSH server, I configured everything is /etc/ssh/sshd_config but when I try to connect using root and its password I get this Error:
The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
Is there anyway to fix this? I've been searching all night please help

Unable to transfer file from Arista switch to external machine

I am trying to transfer a file from Arista switch to an external machine using scp using pyeapi run_command.
Reference:
http://www.nycnetworkers.com/upgrade/copying-from-a-sftp-server/
Code:
import pyeapi
node = pyeayi.connect(transport='https', host='x.x.x.x', username='yyy', password='zzz', enable_pwd='xxx', return_node=True)
node.run_command(['copy flash:/file.log.gz scp://user:password#hostname/location/'], encoding='json')
But it throws the following error,
pyeapi.eapilib.CommandError: Error [1000]: CLI command 2 of 2 'copy flash:/file.log.gz scp:user:password#hostname/location/' failed: could not run command
[Error copying flash:/file.log.gz to scp:user:password#hostname/location/ (Warning: Permanently added 'hostname' (ECDSA) to the list of known hosts.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). lost connection)]

Could not copy slave.jar into '/home/jenkins' on slave

My existing jenkins master-slave connection got broken . I tried establishing the connection via scp command.
On master:
scp ~/ .ssh/id_rsa.pub jenkins#<my_slave_machine>:/tmp
On slave :
• ssh-keygen –b 2048 –t rsa
• Press enter for " Enter file in which to save the key (/home/jenkins/.ssh/id_rsa) : "
• Press enter for " Enter passphrase (empty for no passphrase):"
• Press enter for " Enter same passphrase again:"
• cd .ssh/
• touch authorized_keys
• chmod 600 authorized_keys
• cat /tmp/id_rsa.pub >> authorized_keys
After trying to connect from UI, getting the below error.
[12/05/16 07:53:48] [SSH] Opening SSH connection to <my_slave_machine>:22.
[12/05/16 07:53:49] [SSH] Authentication successful.
[12/05/16 07:53:49] [SSH] The remote users environment is:
ENV=/home/dx00926/.kshrc
FACTERLIB=/var/lib/puppet/rel_RHEL6_64_670/lib/facter
FCEDIT=ed
HISTCMD=0
HOME=/home/dx00926
IFS=$' \t\n'
JOBMAX=0
KSH_VERSION=.sh.version
LINENO=1
LOGNAME=dx00926
MAIL=/var/mail/dx00926
MAILCHECK=600
OPTIND=1
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/opt/adnssh/bin
PPID=1455663
PS2='> '
PS3='#? '
PS4='+ '
PWD=/home/dx00926
RANDOM=6009
SECONDS=0.000
SFTP_PERMIT_CHMOD=1
SFTP_PERMIT_CHOWN=1
SFTP_UMASK=''
SHELL=/bin/ksh
SHLVL=1
SSH_CLIENT='148.112.120.212 35609 22'
SSH_CONNECTION='148.112.120.212 35609 10.33.70.153 22'
TMOUT=0
USER=dx00926
[12/05/16 07:53:49] [SSH] Starting sftp client.
[12/05/16 07:53:49] [SSH] Copying latest slave.jar...
hudson.util.IOException2: Could not copy slave.jar into '/home/jenkins' on slave
at hudson.plugins.sshslaves.SSHLauncher.copySlaveJar(SSHLauncher.java:1054)
at hudson.plugins.sshslaves.SSHLauncher.access$300(SSHLauncher.java:137)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:723)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:706)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: hudson.util.IOException2: Could not copy slave.jar to '/home/jenkins/slave.jar' on slave
at hudson.plugins.sshslaves.SSHLauncher.copySlaveJar(SSHLauncher.java:1049)
... 7 more
Caused by: com.trilead.ssh2.SFTPException: Permission denied (SSH_FX_PERMISSION_DENIED: The user does not have sufficient permissions to perform the operation.)
at com.trilead.ssh2.SFTPv3Client.openFile(SFTPv3Client.java:1201)
at com.trilead.ssh2.SFTPv3Client.createFile(SFTPv3Client.java:1074)
at com.trilead.ssh2.SFTPv3Client.createFile(SFTPv3Client.java:1055)
at hudson.plugins.sshslaves.SFTPClient.writeToFile(SFTPClient.java:93)
at hudson.plugins.sshslaves.SSHLauncher.copySlaveJar(SSHLauncher.java:1039)
... 7 more
[12/05/16 07:53:49] Launch failed - cleaning up connection
[12/05/16 07:53:49] [SSH] Connection closed.
I have even tried the below posts, but did not get the resolution.
Jenkins Slave Permission Denied while copying slave.jar
https://issues.jenkins-ci.org/browse/JENKINS-26259
https://issues.jenkins-ci.org/browse/JENKINS-22651
Jenkins slave set-up - Both Master and Slave Nodes are Linux machines
ENV=/home/dx00926/.kshrc
...
HOME=/home/dx00926
...
USER=dx00926
...
hudson.util.IOException2: Could not copy slave.jar into '/home/jenkins' on slave
...
Caused by: com.trilead.ssh2.SFTPException: Permission denied (SSH_FX_PERMISSION_DENIED: The user does not have sufficient permissions to perform the operation.)
It looks like you're connecting to this server as a user named "dx00926". The simplest explanation for this error is that this "dx00926" user on the remote system doesn't have permission to create files in the directory /home/jenkins, or there's an existing file named "/home/jenkins/slave.jar" there and this user doesn't have permission to overwrite its contents.
Either modify the permission on the /home/jenkins directory to permit dx00926 to create files there, or connect to the remote system with a user that does have permissions to create files there.
Like if you have a username "jenkins" and home dir is "/home/jenkins"
You have to put this home directory in your node configuration, see "Remote root directory: /home/jenkins"
It resolved my issue.. especially for AWS-ec2 and dont set full permission on home directory, it will affect it.
I was having this error. I removed the existing remote.jar in the remote server and try to recreate the agent. It went well now
https://issues.jenkins.io/browse/JENKINS-67258
"Please note, apparently upgrading SSH Build Agents / SSH Slaves Plugin to version 1.32.0 and beyond helps with resolving this problem."
I was having this error, and I tried the above solutions, but the only way I was able to resolve it was by deleting the node, deleting the /opt/jenkins folder, and recreating the folder and the node. After that it worked fine.
sudo chmod -R 777 /home/jenkins

how to secure a MyCloud? Is it already too late?

My laptop is running Ubuntu 14.04 LTS. I have a WMD MyCloud that I am doing backups to with an rsync. The rsync calls usually end with an error.
Some things I have observed. The MyCloud machine has a REST API and I see that someone has tried to hack that. As far as I can tell, the attempt did not succeed.
My backup does this from my laptop, to the MyCloud:
/usr/bin/rsync -a -z -v /home/me/ root#192.168.1.82:/shares/me
Usually I get:
rsync: connection unexpectedly closed (93239 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.0]
and the rsync process is returning 12.
Oddly, if I use a second -v, the process usually succeeds. Why would that be? It is too fast without the second -v?
Something I saw worries me. Again, this is the output on my laptop, running rsync to copy to the MyCloud:
*** stack smashing detected ***: <unknown> terminated
rsync: connection unexpectedly closed (11387 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.0]
and it returns 12. Ouch!
So, does this mean my laptop is infected with something, presumably Heartbleed or something like it?
On my laptop:
$ rsync -h
rsync version 3.1.0 protocol version 31
...
On the MyCloud:
# rsync -h
rsync version 3.0.9 protocol version 30
...
Am I just screwed? Do I just need to update the stuff on the MyCloud? I have updated by Ubuntu laptop several times. Did that not prevent an infection on this machine?
Open to any suggestions.

Resources