Results 1 to 10 of 16
I am using a bash script to ftp a file from a suse linux server to a windows box. Originally it was just an IP addr we went to, but ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 12-13-2011 #1Linux Newbie
- Join Date
- Jun 2006
- Posts
- 141
Help w/ftp script
I am using a bash script to ftp a file from a suse linux server to a windows box. Originally it was just an IP addr we went to, but it has now changed to a share on a virtual windows server.
What I am having a specific problem with is the \\ in the user portion of the script, I have tried everything I know to get the script to accept this but to no avail.
Any help is greatly appreciated.
Thanks
Mace
- 12-13-2011 #2
a windows share and a ftp share are totally not the same thing.
what does your script look like? are you using samba commands? if so, you need to use twice as many '\' than normal.
e.g.
a normal windows share: \\blah\sharename
in linux over samba:
\\\\blah\\sharenamelinux user # 503963
- 12-13-2011 #3Linux Newbie
- Join Date
- Jun 2006
- Posts
- 141
Thank you, the \\\\ worked great, but now I am stuck getting the password to work.
I have tried the original space between the username and password and then I tried inserting \ (up to 4)
With the space the username and password were butted together(ie usernamepassword)
With \ (up to 4 and and or a space ) it wold give username\password BUT cut the password off by the last 3 characters.
So close but so far
Thanks
Mace
- 12-13-2011 #4If that doesn't work, if you can post your script that would be most helpful.Code:
smbclient \\\\blah\\sharename yourpassword -u username
OR, you can use an authentication file. The command would look like:
config file would contain something like:Code:smbclient \\\\\blah\sharename -A /path/to/config/file
also keeps the usernames and passwords out of your scripts, you know, security-type stuffCode:username = foo password = bar
Last edited by scathefire; 12-13-2011 at 06:29 PM. Reason: added an alternative
linux user # 503963
- 12-15-2011 #5Linux Newbie
- Join Date
- Jun 2006
- Posts
- 141
Here is the ftp portion of the script..
ftp -n -v -i IPADDRESS port # << EOF
user share\\\username password
Thanks
Mace
- 12-15-2011 #6Linux Newbie
- Join Date
- Jun 2006
- Posts
- 141
FYI
this all works if we do it manually
mace
- 12-15-2011 #7
Your script makes no sense. Are you using SAMBA or FTP? You are trying to merge to totally different protocols together. Whichever protocol you use will yield a different result.
According to your script you are using FTP, so that means you have installed a FTP server, probably through IIS. Note, these are all assumptions.
So if you are using FTP, your script would not even need the '\\' characters you are talking about.
If you are trying to use Windows File sharing (SMB/Server Message Block/SAMBA), that is a totally different script.Code:IPADDRESS=some.ip.address USER=someuser PW=somepass ftp -n $IPADDRESS <<UPLOAD user $USER $PW ascii #put other commands here quit UPLOADlinux user # 503963
- 12-16-2011 #8Linux Newbie
- Join Date
- Jun 2006
- Posts
- 141
using ftp..I didn't send the whole script just the ftp portion(where the problem lives).
Also the way the current script is written I do need the \s before I didn't
as i said this worked for years until they changed the receiving end
I'll try the symbolics
thx
mace
- 12-16-2011 #9Linux Newbie
- Join Date
- Jun 2006
- Posts
- 141
ok i have misinformed you a bit...yes it is a windows share but we now have to put in the domain not a windows share name.
here is the error i get:
220 Microsoft FTP Service
331 Password required for domain\userid.
530 User domain\userid cannot log in.
Login failed.
mace
- 12-16-2011 #10
Ok, so you are logging in with domain credentials then. I see now why you were wanting the '\'. The reason why you use 2 of them is because they hold special meaning in the shell (as escape characters).
Does this change anything:
I don't work with Microsoft FTP service too much, its just a matter of finding what syntax its looking for really. Most FTP services follow relatively similar patterns.Code:IPADDRESS=some.ip.address USER=mydomain\\myuser PW=somepass ftp -n $IPADDRESS <<UPLOAD user $USER $PW ascii #put other commands here quit UPLOAD
The password wouldn't happen to contain characters like '\' or '@' or '#'?linux user # 503963


Reply With Quote
