Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

At work we have a large network of computer, some linux, some windows. On a windows machine I can go in to my computer and access a network drive simply by typing \ip-address\folder. It'll often ask me for a user name and password and I'll be in.

How can I access these network drives from the command line in linux (ubuntu and red hat)?

share|improve this question
    
take a look into samba software. you will need smbclient and smbmount if you want to mount the shares. Assuming all shares are SMB based. –  BitsOfNix Oct 25 '13 at 19:59

2 Answers 2

If you need to access a directory which is on a Windows host from a *nix based guest, you'll be using samba. Read up on the documentation for your particular distribution. After samba is installed you'd usually just run 'man samba'.

If you're using a gui (nautilus for example) and samba is installed, you'll want to edit the current directory path (default for nautilus is Ctrl+L) and type smb://hostname/path/to/shared/directory, smb:// tells the file browser to use the samba protocol and from there the hardest part is ensuring the path is correct. You will be prompted for credentials and assuming you have permission to access the data you can use the file browser as you normally would for a local directory.

Note: In my experience, not all samba implementations play nice with MS DFS network shares, so depending on your setup, mileage may vary.

share|improve this answer

You can do this with smbclient (which will also need samba):

smbclient --user=yourusername --domain=yourdomain //server/share

This will give you an FTP-like interface to the share which may not be what you're looking for. You can also use the command to download particular files, print files, etc. Check the manpage for full usage information.

If you want to mount the Windows share as a filesystem, you can use the mount.cifs command (on Ubuntu, it's in the cifs-utils package, but your distribution might be different) to mount a windows file share. This will also let you add Windows fileshare mounts to your fstab file for automatic mounting during boot.

I know you asked about command line tools, but the file manager of your windowing environment also might have the ability to connect to a Windows file share too, the Dolphin file manager on KDE can do this, and Nautilus on Gnome can do this as well.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.