Question

script to access windows files..

Asked by: deepakjena_2003

Hi,

I am new to solaris.

I want to write a script on solaris which will get files from one linux box and put files to different windows box.

This is because i wanted to make my solaris box as a central repository to keep the files coming from linux box and my linux box can't access windows box directly due to different ip series..

below diagram will explain the data flow in detail..

Linux Box--------------------------> Solaris Box ----------------------------> Windows Box.

Can anybody help me on this..

Thanks
Deepak

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2005-04-11 at 08:19:20ID21384234
Topic

Sun Solaris

Participating Experts
3
Points
300
Comments
21

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Online Flow Diagram Editor
    We are looking for a package that can edit flow diagrams, the objects (graphics) need to be updatable somehow. It would ideally be online totally, but if it were small enough to quickly download and install then that could be an option. Any pointers gratefully accepted
  2. CVS on solaris : no such repository
    I am trying to setup cvs-1.11.17 server on solaris 9 sparc. I did as follows: 1. Created a cvs group, assigned and given all permission to /opt/repository/CVS 2. $ cvs –d /opt/repository/CVS init 3. $ CVSROOT=/opt/repository/CVS $ export CVSROOT 4. $ cvs import -m &...
  3. "Database Diagram" In Sybase Central 4.3?
    Like SQL Server, is there an option for a Database Diagram in Sybase Central 4.3? I am connecting to a DB (not mine) and would like to know the layout of it and don't see anyway to get a diagram of it. I know how to create/get one in SQL Server, but not in Sybase.
  4. data flow diagram
    Hi! I have recently created a database as an assignment. It's a standard database for a shop and it consists of the following tables: tblSupplier, tblProduct, tblOrder, tblOrderDetail, tblDelivery, tblDeliveryDetail, tblEmployee,tblClient. it does all the standard thi...
  5. data flow diagrams obsolete?
    is data flow diagrams obsolete, or they are still in use vs UML diagrams?

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: PsiCopPosted on 2005-04-11 at 10:11:21ID: 13754668

Depends on HOW the files are available from the Linux box, and HOW the file have to get to the Windoze box. For example, is everything an NFS mount on the Solaris server? Or are you using FTP? Or SFTP with host keys so there's no password sequence? No one is going to be able to write a simple script unless you take some time to *cogently* describe the environment, and what transport mechanisms are available to move the data.

So... HOW do files get moved? Or is THAT the info you're looking for, not a script?

 

by: deepakjena_2003Posted on 2005-04-11 at 13:53:47ID: 13756686

Let me explain clearly about my requirement...

1) My linux box(A) contains webserver log files.
2) i wanted to copy these log files to windows Box (C)
3) there is no network link between A and C
4) i have a central solaris Box(B) which can connect to both A and C.
5) NFS is not configured on these boxes.
6) I can use either ftp or shared folders to get files from A to B and then to C.


in a single line..... the script on "B" should be able to get files from a folder on "A" and put these files to a folder on "C".

The script should to do all the above file transfer in a secure manner as these boxes are production boxes.


Thanks
Deepak

 

by: PsiCopPosted on 2005-04-11 at 17:18:59ID: 13758217

Neither FTP nor shared folders are terribly secure. Among other issues, FTP sends everything in the clear, including authentication credentials. And shared folders, if you're talking about the Windoze variety, are the last thing you'd want to set up on a Linux server, epecially a webserver. Might as well chmod 777 everything.

I would use the Secure FTP (SFTP) function of SSH - this may be included with your Linux distro, but since you haven't bothered to mention which distro or version you have, nor the version of Solaris, its kinda hard to tell you if its in there. SUSE Pro 9.x comes with OpenSSH as part of its install, I can tell you that. If your distro doesn't have it, then you'll need to get and build it. Check out http://www.openssh.org and http://www.openssl.org

OK, so you set up an SSH server on the Linux server, and you create a restricted (perhaps you use rssh) account that can read the webserver log files. You configure the SSH server on the Linux server to only let that account log in from the Solaris server, and probably use hostkeys to help enforce this. This is documented in OpenSSH and related websites.

Solaris v9 and later include a SSH/SFTP client, or you can download and install the OpenSSH/OpenSSL code for Solaris 8. Before v8, it gets trickier, because there is no /dev/random before then (and its a patch for Solaris 8, #112438). Again, what you do is dependent on what version you have and what you've installed.

Finally, you also put an SSH/SFTP server on the Windoze side. I don't do much with Windoze in this respect, so I can't give you precise advice. You may be able to find an OpenSHH port package you can install, or use the commercial Secure Shell package (see http://www.ssh.com), which includes a server in its Windoze product, as I recall. Again, you set the account used to xfer the files as restricted to SFTP only, only from the Solaris server, and only able to write in one place. And use host keys so it doesn't have to login.

 

by: JustUNIXPosted on 2005-04-12 at 02:37:24ID: 13760508

Why not using the Solaris box in the middle as a router between the two
network segements?
a) Make it a router (enabling at least two ethernet interfaces should do).
    Check with ndd -get /dev/ip ip_forwarding  (should be "1")
b) Add the route into network B (between Solaris and Windows boxes)
    on Linux machine:
      route add net <network> <Solaris-IP-in-net-A> 1
    Display routing table:  netstat -rn
c) Add the route into network A (between Solaris an Linux boxes) on
   Windows machine: In a DOS box enter
     route add net <network> <Solaris-IP-in-net-A> metric 1 /P
   (The "/P" makes this entry permanent).
   Display routing table: route print
Now, you can connect directly between Linux and Windows -- and vice
versa.

 

by: JustUNIXPosted on 2005-04-12 at 02:43:14ID: 13760528

Using SaMBa on Solaris (use version 3.x) will allow you to access files in
a shared folder/directory from Windows and Unix simultaneously. You
can also use SaMBa on Linux to share the directoy with your logfiles and
have it accessed from Windows to read the files (or share a folder on the
Win box and have SaMBa (Client) copy the files to it with a simple "cp"
command

Cheers,
JustUNIX

 

by: PsiCopPosted on 2005-04-12 at 07:24:27ID: 13762524

JustUNIX,

The heartburn I'd have with using the Solaris server as a router between the two nets is that it could create a significant security hole. If the Linux webserver is in a DMZ, and its deliberate that there is no direct route to the Windoze box, then setting up a router like you suggest bypasses all that security. The Asker may be in a deliberately-compartmentalized environment. I'd certainly want to limit the exposure of my Windoze box to the 'Net. If this is the case, then the dead-drop method he's seeking is the way to go.

 

by: JustUNIXPosted on 2005-04-12 at 07:36:13ID: 13762674

Hi PsiCop,

I understand your point, but I don't know if this is really the issue. I'd opt for the
easiest option if possible -- let's wait what Deepak says to our suggestions ...

Cheers

 

by: deepakjena_2003Posted on 2005-04-12 at 15:26:13ID: 13767846

Hi,

Actually i am new to solaris aswel as linux....

I am using...

Box A = Linux 2.4.9-e.40enterprise
Box B = Solaris 5.8
Box C =  windows2000 -Terminal Server Edition.

ssh,ftp running on box A and B.

Actually i have no rights to change the hardware configuration of these boxes...

i just wanted to use a simple script which will use secure data communication among these boxes...

JustUNIX,
thanks for suggestion, but i dont' think my security team and hardware team will allow me to do for "router" method for this script.

PsiCop ,
I can use sftp to transfer the files as i feel it's secure bcz i don't have other secure option on my boxes.

Can any body explain in detail how the data flow will happen...?

i am not sure how solaris user will fetch file from linux and put those to windows using sftp.

PsiCop,
R U talking about public key concept, if yes plz give me the details...


Thanks
Deepak

 

by: JustUNIXPosted on 2005-04-13 at 02:20:23ID: 13770444

you may use sftp (secure FTP9, but ssh also allows for scp (secure copy)

On your Solaris box:
scp user@linux:/path/to/file  /tmp/myfile              # get file from Linux box to Solaris box into /tmp dir
scp /tmp/myfile user@windows:\path\to\newfile   # put file onto windows box
rm /tmp/myfile                                                   # remove temp file on this box (Solaris)

If you've set up ssh server on Linux and Windows the right way you will not be asked
for password and this can be fairly easily automated (scripted)

Cheers

 

by: NukfrorPosted on 2005-04-17 at 08:53:33ID: 13801511

deepakjena_2003,

You can put OpenSSH onto your Windows machine using Cygwin (http://www.cygwin.com).  Cygwin on Windows is the bomb !!!  Anyone using that Unix Toolkit POOP that Microsoft puts out is just begging for a trashed system.

As to setting up OpenSSH public key authentication, there are hundreds of "How To"'s on Google.  Just Google for "openssh public key authentication" and you'll have more then enough to get it working.

If you're using the Solaris box as the middle man which its seems you are, you'll need to setup public key authentication for this Solaris machine on the Windows machine and the Linux machine.  This means you need to be very careful with the security/access configuration/profile on that Solaris server once you set this up.

 

by: deepakjena_2003Posted on 2005-04-18 at 15:43:53ID: 13810996

Hi Nukfror ,

i installed OpenSSH from http://www.cygwin.com .
i am able to get shell prompt after the installation.

Can u please guide me how to configure OpenSSH (like changing port # Etc..)

Is it secure if i open my windows box to internet.

Thanks
Deepak

 

by: NukfrorPosted on 2005-04-18 at 17:21:33ID: 13811518

First and foremost, letting anything from the Internet into a system should never be taken lightly.  You should really think about this before you do it.  If you do, you need to stay on top of where OpenSSH is patch wise and be sure to update your Cygwin installation quickly.  OpenSSH will come out with a patch and Cygwin is pretty good about keeping up-to-date but its not immediate.  Usually a couple of days later.

Pretty simple to setup ssh as a service under Windows.  After you've installed it, you need to run ssh-host-config and pretty much answer yes to everything.  Oh ... one note ... you need to run ssh-host-config with an administrative level account.

Once this is done, you can reboot the system and sshd will start up at boot time.  *Or* simply run:

net start "Cyginw sshd"

After this, when you run "netstat -na" you should see port 22 listening.  If you *really* want to change the ssh port number, which I don't necessarily suggest, take a look in /etc/sshd_config (obviously from your bash prompt).  You'll see "Port 22" towards the top.  Change this to whatever you want and then run:

net stop "Cygwin sshd"
net start "Cygwin sshd"

"netstat -na" should now show that port as being listened on.

 

by: deepakjena_2003Posted on 2005-04-19 at 07:39:54ID: 13815878

Hi Nukfror ,

As per your instruction when i tried to setup ssh server i got the following error...

------------------------------
$ ssh-host-config
bash: ssh-host-config:

deepak@12457intech ~
--------------------------------
user "deepak" is the administrator of this NT Box.

i couldn't see any ssh folder under /etc...
---------------------------------------
$ cd /etc

deepak@12457intech /etc
$ ls
DIR_COLORS   group     passwd       profile    setup
bash.bashrc  hosts     postinstall  protocols  skel
defaults     networks  preremove    services   termcap

deepak@12457intech /etc
-----------------------------------------


Please suggest...

Thanks
Deepak

 

by: deepakjena_2003Posted on 2005-04-19 at 09:21:15ID: 13816950

i reinstall it.....it looks working now...

i executed "ssh-host-config " command and it executed successfully.....

But when i start or stop the service it's giving error...

$ net start "Cyginw sshd"
The service name is invalid.

More help is available by typing NET HELPMSG 2185.

$ net stop "Cygwin sshd"
The service could not be controlled in its present state.

More help is available by typing NET HELPMSG 2189.


Please suggest...

Thanks
Deepak

 

by: NukfrorPosted on 2005-04-19 at 11:36:34ID: 13818369

You misspelled Cygwin - noticed in your start command you spelled it "Cyginw" vs "Cygwin" :)

 

by: deepakjena_2003Posted on 2005-04-19 at 13:04:59ID: 13819152

yes... i tried these also.. it didn't work out...

net stop "Cygwin sshd"
net start "Cygwin sshd"
..........................................................

am i missing something at the time of installation......

i did not select all packages because it failed 3 times to download all packages...

so i selected basic ,lib and  net package which has openssh

i only wants ssh server setup so that i can "scp" files from my central location to this "NT" Box with the help of public key authentication...

Any suggestion...

Thanks
Deepak
 

 

by: deepakjena_2003Posted on 2005-04-20 at 06:15:41ID: 13823917

Now when i tried to ssh to the box itself from
"Cygwin" shell prompt..i am not allowed to ssh....

$ ssh 192.168.30.1
deepak@192.168.30.1's password:
Permission denied, please try again.

i am also getting same error msg when tried to connect from solaris box to this NT Box...



do i have to setup any permission for any user before i connect using ssh...

 

by: NukfrorPosted on 2005-04-20 at 11:11:26ID: 13827150

Well, one thought comes to mind.  Is the deepak login a local account or is this a login within a NT domain ?

The logins I used in SSH are all local-to-the-box logins.

This may have something to do with it.

 

by: deepakjena_2003Posted on 2005-04-22 at 13:32:38ID: 13846405

deepak is a local account...

finally i installed openssh in NT and it's working and i am able to connect to nt box from my solaris box.

the problem i am facing now is i can't ssh/scp to nt box using public key authentication.

it's asking me password and once i provide the password i am able to connect to nt box.

i copied the content of ".ssh/id_rsa.pub" from home dir of "deepak" user(Solaris) to  ".ssh/authorized_keys" of "deepak" user in nt.


I created a local admin named "deepak" in nt.

i need silent login to nt so that i can use scp command in my script.


Public ley authentication is working for me when i use "linux" as my destination server but it fails when i use nt as destination server.


Is there any nt specific configuration required on nt ssh server to enable public key authentication ...?

Thanks
Deepak


 

by: deepakjena_2003Posted on 2005-04-29 at 22:10:45ID: 13899827

thanks a lot to every one for valuable informatioin

 

by: JustUNIXPosted on 2005-05-02 at 00:45:26ID: 13907420

In any case, the SSH server (sshd) must be configured to accept key authentication (interactive (user/passwd) is the default)

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...