8.2 Command line method
The command line method is very flexible, as you can use it on a minimal system without a GUI. It uses the command
mount. The following is a typical command line to “mount” a SMB volumn from another computer:
mount -t cifs //10.0.2.4/homes /media/share -ocredentials=~/10-0-2-4.credentials,uid=mainuser,rw
Here is a quick explanation of this command:
- mount
This is the command to “mount” a device to a “mount point” in the file system. A mount point is essentially
a directory. If the mount operation is successful, then the files in the device will show up as the content of the
mount point.
- -t cifs
The -t option specifies the type of file system. In this case, cifs refers to “Common Internet File System”.
- //10.0.2.4/homes
This is the “device” to be mounted. In this case, it designates a host 10.0.2.4 and a service homes.
- /media/share
This is the mount point. This folder must exist before the mount command executes.
- -ocredentials=~/10-0-2-4-credentials,uid=root,rw
This specifies all the optional parameters. credentials refer to a file that contains the user name and password.
uid=root means the owner of the mount point is root, and rw means root has both read and write permissions
to the file system.
The credential file should be similar to the following:
username=remoteUserName
password=passwordOfUser
Make sure the credential file is readable only by the user owner!