Как скопировать из сети Windows на машину Linux

253
user327725

Мне нужно создать пакет, который регулярно копирует файл file.txt с удаленной машины Windows (находится в \ 1.2.3.4 \ Client $) на машину Linux, расположенную в 7.8.9.10. Пакет должен работать на машине Linux. Какой самый простой способ сделать это?

0

2 ответа на вопрос

1
Rich Homolka

My guess is that the easiest is to:

Get Windows file sharing working.

Make sure you have the smbclient program on your Linux box. This is usually in a package called samba-client or similar.

Make a script, something like smbclient //1.2.3.4/Share -c 'get /file /dest/dir1'

Depending on what your permissions are, you may want to add an authentication file, name and password. so it would be smbclient -a smb_auth.txt //1.2.3.4/Share -c 'get /file /dest/dir1'

Schedule this in cron.

1
KronoS

Note: This doesn't match your requirements exactly

If you can go from Windows to linux instead of the reverse, you can use WinSCP and it's 'synchronize folders' feature:

  1. Connect to the linux box using WinSCP
  2. Select: Commands --> Keep Remote Directory up to Date...

    File Menu showing Commands --> Keep Remote Directory up to Date...

  3. Set the parameters as needed

    Keep remote directory up to date dialog box

This will keep the remote directory up to date automatically for you. You can also use their scripting functionality to keep things updated.