Link to home
Start Free TrialLog in
Avatar of deepakjena_2003
deepakjena_2003

asked on

script to access windows files..

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
Avatar of PsiCop
PsiCop
Flag of United States of America image

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?
Avatar of deepakjena_2003
deepakjena_2003

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of PsiCop
PsiCop
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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.
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
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
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
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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.
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
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
You misspelled Cygwin - noticed in your start command you spelled it "Cyginw" vs "Cygwin" :)
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
 
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...

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.
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


thanks a lot to every one for valuable informatioin
In any case, the SSH server (sshd) must be configured to accept key authentication (interactive (user/passwd) is the default)