This is an article where the content specified in the article is specifically written to show how to copy file from Linux operating system to Windows operating system. In order to achieve it, smbclient command tool which is actually a command based on Samba protocol is utilized. Samba itself based on the description given in Wikipedia, it is a free software re-implementation of the SMB/CIFS networking protocol, and was originally developed by Andrew Tridgell. Samba provides file and print services for various Microsoft Windows clients and can integrate with a Microsoft Windows Server domain, either as a Domain Controller (DC) or as a domain member. As of version 4, it supports Active Directory and Microsoft Windows NT domains. So, how can a file is transferred using smbclient ?. Below is the actual command performed to do it given the pattern at first to know the command format :
smbclient '//xxx.xxx.xxx.xxx/tmp' -U Administrator -c "put file_source file_target" -m SMB2 Description : smbclient : it is a command tool for connecting to SMB/CIFS resource in a certain server //xxx.xxx.xxx.xxx/tmp : it is a resource URL of SMB/CIFS location which exist in a server with the IP Address of xxx.xxx.xxx.xxx and 'tmp' as the name of the sharing folder source. -U Administrator : it is an additional parameter for specifying username to connect to the SMB/CIFS resource -c : it is an additional parameter for specifying command string which to be executed "put file_source file_target" : the command string which is going to be executed where in this context is put -m : it is an additional parameter to specify max-protocol or the level of SMB protocol used SMB2 : the level of SMB protocol used which in this context, it is SMB version 2 or SMB2
The above command pattern is used because the previous command used without having the -m SMB2 additional parameter, it cannot be executed successfully. It is because, it will stuck and it generates error as shown below :
root@hostname:/mnt# smbclient '//xxx.xxx.xxx.xxx/tmp' -U Administrator -c "put /home/user/notes.txt home-folder-user" -m SMB2 WARNING: The "syslog" option is deprecated Enter Administrator's password: protocol negotiation failed: NT_STATUS_CONNECTION_RESET root@hostname:/mnt#
It is facing the same situation with the one described in the article titled ‘How to Solve Error Message : negotiation failed: NT_STATUS_CONNECTION_RESET upon connecting to share folder using smbclient protocol’ in this link. So, the above command execution need to be modified first before further execution by adding additional parameter -m SMB2 as shown below :
root@hostname:/mnt# smbclient '//xxx.xxx.xxx.xxx/tmp' -U Administrator -c "put /home/user/notes.txt home-folder-user" -m SMB2 WARNING: The "syslog" option is deprecated Enter Administrator's password: Domain=[WORKGROUP] OS=[] Server=[] putting file /home/user/notes.txt as \notes.txt (23,3 kb/s) (average 23,3 kb/s) root@hostname:/mnt#