Find the answer to your Linux question:
Results 1 to 7 of 7
hi all, I have a windows shared location //SharedMachinename/sourcelocation/loc/file . //SharedMachinename/sourcelocation is mapped to my network drive Y: on win system. In unix machine i am using the scp command ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2013
    Posts
    6

    transfer files from mapped network on win to unix using scp


    hi all,

    I have a windows shared location //SharedMachinename/sourcelocation/loc/file . //SharedMachinename/sourcelocation is mapped to my network drive Y: on win system.

    In unix machine i am using the scp command to transfer file from windows mapped network drive, Y: , to unix system , but unable to transfer file as it returns error saying "Not a directory"

    following is the command: "scp [email]user@winMachine:Y:/loc/file/trans.sh DestinationLocation"

    error: scp: Y:/loc/file/trans.sh: Not a directory

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,444
    Hi and welcome

    Please correct me if there is an understanding issue:
    - There is a windows machine "SharedMachinename"
    - "SharedMachinename" serves a share called "sourcelocation" via cifs
    - This "sourcelocation" is mapped to your local windows workstation on networkdrive Y:


    So, how is the unix machine involved into this?
    Did you mount the cifs share there?
    And why scp?
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    Jan 2013
    Posts
    6
    re-phrasing the question:

    //SharedMachinename/sourcelocation/loc/file(will call it sourceLoc) is a windows share hosted on a server.

    As of now i am using winscp(on local win system) to transfer the file from sourceLoc to unix.
    I am accessing this sourceLoc in my local win system by mapping to a network drive.

    How do i copy the files in the sourceLoc to unix system and via command line without the intervention of local win system .

    Was trying if i could use scp for the same

  4. $spacer_open
    $spacer_close
  5. #4
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,444
    No, you cant use scp on the unix box to access the windows (cifs) share, because these are two different protocols.

    You can mount the cifs share.
    For that, you need the mount.cifs command, which in debian is part of the cifs-utils package.
    Your unix should have a similar package.

    The mountpoint can be permanent, aka: Defined in /etc/fstab
    Or adhoc via autofs: Whenever a unix tool tries to access the cifs mountpoint, autofs will establish the mount and close it after X seconds of non-action.

    The latter approach has the advantage, that you do not need to monitor the mountpoint.
    Last edited by Irithori; 01-23-2013 at 10:04 AM. Reason: typo
    You must always face the curtain with a bow.

  6. #5
    Linux User Krendoshazin's Avatar
    Join Date
    Feb 2005
    Location
    London, England
    Posts
    471
    Once you have the CIFS package it's quite simple to mount the share.
    Code:
    root@wintermute:~# mount -t cifs //192.168.2.241/openshare /mnt/network/zdrive/ -o credentials=/etc/cifsauth
    root@wintermute:~# ls -l /mnt/network/zdrive/
    total 1048576
    -rwxr-xr-x 0 root root 212266 Nov 16 08:59 1*
    drwxr-xr-x 0 root root      0 Dec 27 09:58 24th\ Dec/
    drwxr-xr-x 0 root root      0 Jan 23 09:55 Ads/
    drwxr-xr-x 0 root root      0 Nov 14 17:05 Audio/
    drwxr-xr-x 0 root root      0 Jan  9 14:30 Base/
    -rwxr-xr-x 0 root root  25256 Oct 29 16:21 Deletions.bat*
    -rwxr-xr-x 0 root root  23803 Oct 12 16:40 DellDeletions.bat*
    drwxr-xr-x 0 root root      0 Nov  1 12:50 Flash/
    drwxr-xr-x 0 root root      0 Jan 10 12:12 Images/
    drwxr-xr-x 0 root root      0 Nov 16 17:32 New\ folder/
    drwxr-xr-x 0 root root      0 Sep 26 14:40 WS/
    drwxr-xr-x 0 root root      0 Aug 14 04:57 XML/
    -rwxr-xr-x 0 root root     86 Sep 26 11:52 driveonline.txt*
    drwxr-xr-x 0 root root      0 Nov 19 16:52 temp/
    /etc/cifsauth contains the username and password for accessing the share, and should be in the following format:
    Code:
    username=
    password=
    You can, of course, write an entry into fstab and simply mount it that way.
    Code:
    //192.168.2.240/ldrive /mnt/network/ldrive cifs credentials=/etc/cifsauth  0   0
    and then simply mount it
    Code:
    root@wintermute:~# mount /mnt/network/ldrive/
    root@wintermute:~# cd /mnt/network/ldrive/
    root@wintermute:/mnt/network/ldrive# ls
    !!!CONFICKER/                                       CMSContent/                   Knowledgebase/                      Thumbs.db*
    !Server\ Building/                                  ClubCom\ software/            Knowledgebase\ workthough\ roughs/  Workshop/
    !Temp/                                              DLL\ Error\ Swap\ Outs.xlsx*  LogMeIn/                            _SYNCAPP/
    $AVG/                                               Downloads/                    Mac\ OS\ X\ Downloads/              avg_arl_cdi_all_120_120823a5411.iso*
    $RECYCLE.BIN/                                       Drivers/                      Macros/                             ben\ list/
    100308\ -\ LA\ Ad\ Playback\ Summary\ Feb\ 10.xls*  Eclipse\ Service/             Screensavers/                       complete_package-updated/
    120126\ -\ DLL\ snapshot.xlsx*                      FOR\ STEVE/                   Shepperton\ Technicals/             control.txt*
    120828-HDSet/                                       FazztKey/                     Site\ Connections/                  dialer/
    AutoContent/                                        Flash/                        Streaming\ Radio/
    Backup/                                             For\ James/                   System\ Volume\ Information/
    Bat\ Files/                                         KenCast\ scripting/           TechRef/
    Then just write to it like you normally would.

  7. #6
    Just Joined!
    Join Date
    Jan 2013
    Posts
    6
    The following packages were available in my system:

    [root@linmach ~]# rpm -qa | grep samba*
    samba-winbind-3.5.4-68.el6.x86_64
    samba-winbind-clients-3.5.4-68.el6.x86_64
    samba-3.5.4-68.el6.x86_64
    samba-client-3.5.4-68.el6.x86_64
    samba-common-3.5.4-68.el6.i686
    samba-common-3.5.4-68.el6.x86_64
    samba-winbind-clients-3.5.4-68.el6.i686

    [root@linmach ~]# rpm -qa | grep cifs*
    cifs-utils-4.4-5.el6.x86_64

    executing the following command
    mount -t cifs //hostname/share /mnt/temp -o credentials=/etc/cifsauth

    gives error
    mount error 13 = Permission denied
    Refer to the mount.cifs(8 ) manual page (e.g.man mount.cifs)

    /etc/cifsauth
    username=user
    password=password
    domain=domainname
    Last edited by minchu; 01-24-2013 at 05:02 PM. Reason: typo

  8. #7
    Just Joined!
    Join Date
    Jan 2013
    Posts
    6

    Thumbs up

    thank you Irithori and Krendoshazin, the issue is solved.. I am able to successfully mount the shared folder and transfer the files ..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •