Mounting via SMB

Jan 04, 2009 21:24


Originally published at Dom's Blog. You can comment here or there.

When a folder on a Windows system is exported, it is possible to mount it on a linux system using smbfs. To this end, it may be necessary to install the relevant “smbfs” package, after which the command “mount.cifs” is available. The command to mount a filesystem on a one-off basis might be as follows:

$ sudo mount -t smbfs -o user=administrator,uid=500,gid=100 //192.168.1.6/sharename /mnt/samba

After executing the command, and possibly entering the linux user password for the purposes of running the command within sudo, you will be asked for the relevant password on the windows system, in this example the administrator password.

If the username and password are invalid, you may receive an IO error, it may be that the user specified does not have permissions to access the exported folder.

An alternative method of authentication is to use a credentials file, which contains the username and password:

The credentials file should contain just the following two lines:
username=value
password=value

The “credentials” option can then be used to point to this file. You should ensure that the file is properly secured with the relevant permissions.

$ sudo mount -t smbfs credentials=/home/dominic/.windows-user,uid=500,gid=100 //192.168.1.6/sharename /mnt/samba

sysadmin

Previous post Next post
Up