accessing smb folders in terminal

Derek Broughton derek at pointerstop.ca
Thu Jan 8 16:07:15 UTC 2009


Rashkae wrote:

> Kevin wrote:
>> I am able to use GUI (Nautilus and Firefox) to access smb://windows_host/
>> folder on my Ubuntu 8.10. Can someone please advise how to access the
>> folder in a terminal?  I want to write a script to move files between
>> windows_host and Ubuntu.
>> 
> 
> You have 2, possibly 3 choices.

Four (or more) :-)
> 
> 1. You can mount the remote filesystem.  You need super user privilages
> to do this.  Install the smbfs package.
> 
> sudo mkdir /mnt/network
> 
> sudo mount -t cifs //remote/sharename /mnt/network -o
> username=remoteUsername uid=localUsername

If the remote filesystems are predictable, add them to /etc/fstab with the 
"user" option, you can then mount them as user.  I have these:

> //HOST1/shared /home/derek/DF_SHARED cifs \
>   noauto,user,credentials=/home/derek/.mar,rw 0 0
> //HOST2/D$/Plone3 /home/derek/DF_VDC cifs  \
>   noauto,user,credentials=/home/derek/.vdc,rw 0 0

Using the "credentials" files means that, while a superuser has to do the 
actual setup, they don't need to know your passwords.

fwiw, I sometimes have trouble hibernating the system when those shares are 
still mounted - you should umount them in ls /etc/network/if-down.d/






More information about the ubuntu-users mailing list