LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-09-2016, 08:57 AM   #1
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Rep: Reputation: Disabled
Copy from Linux to Windows(Samba)


Im trying to use 'smbclient' to move a file from Linux to Windows. I think I'm getting the syntax wrong. The Windows folder is visible in Linux command line, it is automounted.
 
Old 12-09-2016, 09:00 AM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
If you think you are getting the syntax wrong, you should share the syntax that you are using.
 
Old 12-09-2016, 09:01 AM   #3
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
If the folder is automounted then use any of the normal linux copy/move commands
 
Old 12-09-2016, 09:31 AM   #4
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
Yes, I tried using 'mv' and 'cp' with no success. The Linux admin told me I should use smbclient. Which is weird being that I can see the Windows folders from the Linux command line. I tried this and it didn't work:

smbclient //dir1/dir2/dir3/dir4/windowsfoldertocopyfileto -c "get \\dir1\dir2\dir3\dir4\filetocopyinlinux.xlsx"
 
Old 12-09-2016, 09:43 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
I believe the correct syntax with specifying a username/password is:
Code:
smbclient //windows_server_NETBIOS_NAME/windows_folder_tocopy_file_from -U WINDOWS_USER%WINDOWS_PASSWORD  -c "get some_file.xlsx"
I did post a similar command in your other thread...

Last edited by michaelk; 12-09-2016 at 09:46 AM.
 
Old 12-09-2016, 09:49 AM   #6
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
I should have mentioned that one of the folders in the Windows path has a name that has a space
 
Old 12-09-2016, 09:53 AM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Try using quotes.
Code:
... "//windows_server_NETBIOS_NAME/windows_folder_tocopy_file_from"...
 
Old 12-09-2016, 09:54 AM   #8
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
I tried that.............. I get NT_STATUS_BAD_NETWORK_NAME
 
Old 12-09-2016, 09:56 AM   #9
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
And remember to try to never make directories or filenames with spaces in them in the future. It complicates things unnecessarily with quotes and escapes.
 
Old 12-09-2016, 09:57 AM   #10
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
Also, when I try using the ip address I get..........................NT_STATUS_LOGON_FAILURE
 
Old 12-09-2016, 09:58 AM   #11
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Ah. He forgot to leave the sharename alone. Do this:

...//windows_server_NETBIOS_NAME/"windows_folder_tocopy_file_from"...
 
Old 12-09-2016, 09:58 AM   #12
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
@szboardstretcher............yea the Win admins did that, expected cause Linux admins wouldn't do that
 
Old 12-09-2016, 10:00 AM   #13
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
@szboardstretcher...........actually Ill be copying a file from Linux to Windows
 
Old 12-09-2016, 10:03 AM   #14
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
@szboardstretcher.............I tried your last suggestion and only got a '>' prompt

UPDATE - I had an extra " sorry. Took it out and got NT_STATUS_BAD_NETWORK_NAME

Last edited by trickydba; 12-09-2016 at 10:05 AM.
 
Old 12-09-2016, 10:05 AM   #15
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
You can try using a backslash to escape the space.

Are you using a valid share name?
smbclient -L windows_IP (or netbios name) Just press enter when prompted for a password.

Is the actual directory you trying to download from a sub-directory from the share? If so then you need to add a cd command

smbclient //windows_name/share_name -U windows_user -c "cd \"sub dir\"; put files"

Last edited by michaelk; 12-09-2016 at 10:23 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows 7 freeze when copy files to Samba Tectu Linux - Server 12 04-29-2012 08:14 PM
Shell script to copy all folders older than 7 days from Linux to Windows by samba blackthu80 Linux - General 4 03-17-2011 12:29 AM
can't copy from windows to linux(samba) kaibs Linux - Software 2 02-27-2007 01:57 AM
Copy files from Windows to Samba bkesting Linux - Software 2 11-23-2004 11:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration