1

How to Access a Windows shared folder from Linux using the command line

This article will describe step-by-step how to access a shared folder based on Windows from a Pyramid deployment that is based on Linux.

If you haven't done so already, you will need to create a shared folder in Windows.

  1. Right-click the folder you want to share and go to Properties.
  2. Go to Sharing tab -> Advance Sharing:

  3. Tick Share this folder and Ok:

  4. Click Share

  5. Add Everyone with Permission Level of Read/Write

 

How to  Access a Windows shared folder from Linux using the command line

  1. If you don't have it already, you will need to install smbclient, which can be done with the following commands:
            For Ubuntu\Debian: sudo apt-get install smbclient
            For CentOS: sudo yum install samba-client
                                   sudo yum install samba-common-tools
     
  2. If you are using a machine that is on a domain, you will need to change the configuration and add your domain by editing smb.conf:
           sudo nano /etc/samba/smb.conf
    And change:
           -security = domain
           -workgroup = WORKGROUP
     
  3.  With smbclient installed, you can connect to your Windows share using the command:
           sudo smbclient /PathOfTheSharedFolder -U domain/YourUser
     
  4. Enter your user password
     
  5. Once authenticated, you are placed at an smb: \> prompt.
     
  6. Here, you can use the ls or dir command to list files.
     
  7. Use the command get filename.ext to transfer a file named filename.ext from your Windows share to your Linux machine.

NOTE: If the file name contains spaces, make sure to enclose it in double quotes.
For example: get "My new file.txt".

Reply

null